public class Arrays extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
array(T... values)
Returns an array containing the given arguments.
|
static <T> boolean |
hasOnlyNullElements(T[] array)
Returns
true if the given array has only null elements, false otherwise. |
static boolean |
isArray(Object o)
Indicates whether the given object is not
null and is an array. |
static boolean |
isArrayTypePrimitive(Object o) |
static <T> boolean |
isNullOrEmpty(T[] array)
Indicates whether the given array is
null or empty. |
static boolean |
isObjectArray(Object o) |
static <T> List<T> |
nonNullElementsIn(T[] array)
Returns all the non-
null elements in the given array. |
static IllegalArgumentException |
notAnArrayOfPrimitives(Object o) |
public static boolean isArray(Object o)
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 isNullOrEmpty(T[] array)
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.@SafeVarargs 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 <T> List<T> nonNullElementsIn(T[] array)
null elements in the given array.T - the type of elements of the array.array - the given array.null elements in the given array. An empty list is returned 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 boolean isObjectArray(Object o)
public static boolean isArrayTypePrimitive(Object o)
public static IllegalArgumentException notAnArrayOfPrimitives(Object o)
Copyright © 2013–2016 AssertJ. All rights reserved.