commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Dacek (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LANG-1402) ArrayUtils should have null and index-safe get methods.
Date Sat, 07 Jul 2018 15:32:00 GMT
Mark Dacek created LANG-1402:
--------------------------------

             Summary: 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


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}
 

 



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

Mime
View raw message