commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1402) ArrayUtils should have null and index-safe get methods.
Date Sat, 07 Jul 2018 16:48:00 GMT

    [ https://issues.apache.org/jira/browse/LANG-1402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535832#comment-16535832
] 

ASF GitHub Bot commented on LANG-1402:
--------------------------------------

GitHub user MarkDacek opened a pull request:

    https://github.com/apache/commons-lang/pull/336

    LANG-1402: Null/index safe get methods for ArrayUtils

    @chtompki 
    If this is deemed worthy or needs improvement - let me know. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MarkDacek/commons-lang LANG-1402

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/336.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #336
    
----
commit 6dacc2a421790770657f6e1f7ca8d6ec2e7f3a82
Author: MarkDacek <mark.dacek@...>
Date:   2017-04-02T01:19:01Z

    Merge remote-tracking branch 'APACHE/master'

commit a99631af9e24c2489ea63656decf89f506274519
Author: MarkDacek <mark.dacek@...>
Date:   2017-04-22T13:59:14Z

    Merge remote-tracking branch 'APACHE/master'

commit 95530e0be9bf6ab70c627295517d018ad3280489
Author: MarkDacek <mark.dacek@...>
Date:   2017-04-24T22:18:28Z

    Merge remote-tracking branch 'APACHE/master'

commit f4430b63a1bebc74ccb8519474d56c0918c9aea4
Author: MarkDacek <mark.dacek@...>
Date:   2017-06-19T01:23:56Z

    Merge remote-tracking branch 'APACHE/master'

commit 7ee1c65dc88ef3d9a83271b67fc210e7520762e1
Author: MarkDacek <mark.dacek@...>
Date:   2017-09-05T00:56:27Z

    Merge remote-tracking branch 'APACHE/master'

commit ce79ff2c77a2bcdf77300d470f418c1645742c5d
Author: MarkDacek <mark.dacek@...>
Date:   2017-09-24T16:00:22Z

    Merge remote-tracking branch 'APACHE/master'

commit 622824a51cd4f6cfee86c2ad3029821c7f096a36
Author: MarkDacek <mark.dacek@...>
Date:   2017-10-23T22:57:29Z

    Merge remote-tracking branch 'APACHE/master'

commit 56ac7bb06a7ff91358ffa837ce5dbfe4ad551454
Author: MarkDacek <mark.dacek@...>
Date:   2018-02-14T23:44:54Z

    Merge remote-tracking branch 'APACHE/master'

commit 526d1999b62d521a6c7bd9e1c9d1207809032a2e
Author: MarkDacek <mark.dacek@...>
Date:   2018-07-07T15:27:05Z

    Merge remote-tracking branch 'APACHE/master'

commit 91e0050de89c1430dfe98e4e8423c9dd82449fd2
Author: MarkDacek <mark.dacek@...>
Date:   2018-07-07T16:45:15Z

    LANG-1402: added get methods to ArrayUtils

----


> ArrayUtils should have null and index-safe get methods.
> -------------------------------------------------------
>
>                 Key: LANG-1402
>                 URL: https://issues.apache.org/jira/browse/LANG-1402
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: General
>            Reporter: Mark Dacek
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> There should be a safe way to retrieve a value from array without having to check for
null and length. It would be a very simple implementation but could save developers a great
deal of time in writing and testing.
>  
> Something like 
>  
> {code:java}
> String[] a = null;
> ArrayUtils.get(a, 5); //returns null
> a = new String[5];
> ArrayUtils.get(a, 10); // returns null
>  
> a[0] = "Hello World";
> ArrayUtils.get(a, 0); // returns "Hello World"
> {code}
>  
>  We could handle a few other cases - a default return value. The tricky/annoying thing
is the need to cast everything in order to make this 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message