DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26594>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26594 [lang] add getLength() method to ArrayUtils Summary: [lang] add getLength() method to ArrayUtils Product: Commons Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Lang AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi, I need a method to determine the length of an array which doesn't throw a NPE if the array is null (this makes the java.lang.reflect.Array.getLength() method unsuitable for me because it throws a NPE if array is null). Here is a possible implementation for an Object array: public static int getLength(final Object[] array) { if (array == null) { return 0; } else { return array.length; } } or, maybe you can use Object which makes this method usable for primitive arrays as well: public static int getLength(final Object array) { if (array == null) { return 0; } else { return java.lang.reflect.Array.getLength(array); } } Can someone please add such a method ? thanks, Maarten --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
