|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fest.util.Arrays
public class Arrays
Utility methods related to arrays.
| Method Summary | ||
|---|---|---|
static
|
array(T... values)
Returns an array containing the given arguments. |
|
static
|
copyOf(T[] original,
int newLength)
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. |
|
static String |
format(Object array)
Returns the String representation of the given array, or null if the given object is either
null or not an array. |
|
static
|
hasOnlyNullElements(T[] array)
Returns true if the given array has only null elements, false otherwise. |
|
static boolean |
isArray(Object o)
Returns true if the given object is not null and is an array. |
|
static
|
isEmpty(T[] array)
Returns true if the given array is null or empty. |
|
static
|
nonNullElements(T[] array)
Returns a new array containing the non-null elements of the given array. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isArray(Object o)
true if the given object is not null and is an array.
o - the given object.
true if the given object is not null and is an array, otherwise false.public static <T> boolean isEmpty(T[] array)
true if the given array is null or empty.
T - the type of elements of the array.array - the array to check.
true if the given array is null or empty, otherwise false.public static <T> T[] array(T... values)
T - the type of the array to return.values - the values to store in the array.
public static String format(Object array)
String representation of the given array, or null if the given object is either
null or not an array. This method supports arrays having other arrays as elements.
array - the object that is expected to be an array.
String representation of the given array.public static <T> T[] nonNullElements(T[] array)
null elements or if it is empty. This method returns null if the given array
is null.
T - the type of elements of the array.array - the array we want to extract the non-null elements from.
null if the given array is
null.public static <T> boolean hasOnlyNullElements(T[] array)
true if the given array has only null elements, false otherwise. If given array is
empty, this method returns true.
T - the type of elements of the array.array - the given array. It must not be null.
true if the given array has only null elements or is empty, false otherwise.
NullPointerException - if the given array is null.
public static <T> T[] copyOf(T[] original,
int newLength)
null. Such
indices will exist if and only if the specified length is greater than that of the original array.
T - the component type of the array.original - the array to be copied.newLength - the length of the copy to be returned.
NegativeArraySizeException - if newLength is negative.
NullPointerException - if original is null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||