public class Arrays extends Object
| Modifier and Type | Method and Description |
|---|---|
static int[] |
array(AtomicIntegerArray atomicIntegerArray)
Returns an int[] from the
AtomicIntegerArray, null if the given atomic array is null. |
static long[] |
array(AtomicLongArray atomicLongArray)
Returns an long[] from the
AtomicLongArray, null if the given atomic array is null. |
static <T> T[] |
array(AtomicReferenceArray<T> atomicReferenceArray)
Returns an T[] from the
AtomicReferenceArray, null if the given atomic array is null. |
static <T> T[] |
array(T... values)
Returns an array containing the given arguments.
|
static List<Object> |
asList(Object array)
Get the values of any array (primitive or not) into a
List<Object>. |
static Object[] |
asObjectArray(Object array)
Get the values of any array (primitive or not) into a
Object[]. |
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) |
static <T> T[] |
prepend(T first,
T... rest) |
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 Object[] asObjectArray(Object array)
Object[].array - array passed as an object to support both primitive and Object arrayObject[].IllegalArgumentException - it the given Object is not an array.public static List<Object> asList(Object array)
List<Object>.array - array passed as an object to support both primitive and Object arrayList<Object>.IllegalArgumentException - it the given Object is not an array.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 int[] array(AtomicIntegerArray atomicIntegerArray)
AtomicIntegerArray, null if the given atomic array is null.atomicIntegerArray - the AtomicIntegerArray to convert to int[].public static long[] array(AtomicLongArray atomicLongArray)
AtomicLongArray, null if the given atomic array is null.atomicLongArray - the AtomicLongArray to convert to long[].public static <T> T[] array(AtomicReferenceArray<T> atomicReferenceArray)
AtomicReferenceArray, null if the given atomic array is null.T - the type of elements of the array.atomicReferenceArray - the AtomicReferenceArray to convert to T[].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)
public static <T> T[] prepend(T first,
T... rest)
Copyright © 2014–2019 AssertJ. All rights reserved.