Java Reference
In-Depth Information
toString and deepToString Return a string representation of the
contents of the array. There are no subarray versions. The string
consists of a comma seperated list of the array's contents, en-
closed by ' [ ' and ' ] '. The array contents are converted to strings
with String.valueof . The toString method for Object[] converts
any nested arrays to strings using Object.toString . The deep-
ToString method returns a string representation of an Object[] re-
cursively converting nested arrays to strings as defined by this
method.
The methods sort and binarySearch have two overloads for Object arrays.
One assumes that its elements are comparable (implement the Compar-
able interface). The second uses a provided Comparator object instead,
so you can manipulate arrays of objects that are not comparable or for
which you do not want to use the natural ordering.
You can view an array of objects as a List by using the object returned
by the asList method.
public static <T> List<T> asList(T... elems)
This can take an actual array reference, or it can conveniently create an
array from the given sequence of elements. The list is backed by the un-
derlying array, so changes made to the array are visible to the list and
vice versa. The returned list allows you to set elements, but not to add or
remove themit is a modifiable list, but not a resizable list. Using a List for
access to an underlying array can give you useful features of List , such
as using synchronized wrappers to synchronize access to the underlying
array.
 
Search WWH ::




Custom Search