Wednesday, August 29, 2018

Apache Commons ArrayUtils.toString() Vs. JDK Arrays.toString()

Apache Commons Lang provides an ArrayUtils class that includes the method toString(Object) that "outputs an array as a String." In this post, I look at various situations in which this method might still be useful when the JDK provides the Arrays.toString(Object[]) method, along with several overloaded versions of that method on the  Arrays class for arrays of primitive types.

At one point, a reason to use the Apache Commons Lang ArrayUtils.toString(Object) method might have been that there was no alternative provided by the JDK. Arrays.toString(Object[]) was introduced with J2SE 5 ( late 2004) where as Apache Commons Lang has had ArrayUtils.toString(Object) since at least Lang 2.0 ( late 2003).



from DZone.com Feed https://ift.tt/2PeZtrQ

No comments:

Post a Comment