Class ArrayUtil
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final boolean[]static final byte[]static final double[]static final float[]static final int[]static final long[]static final short[]
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> T[]add(T[] array, T element) Copies the given array and adds the given element at the end of the new array.static <T> T[]static booleanisStrictlyAscending(long[] array) static int[]toIntArray(List<Integer> ints) toIntList(int[] ints) static long[]toLongArray(List<Long> longs) toLongList(long[] longs) static boolean[]toPrimitive(Boolean[] array) Converts an array of object Booleans to primitives.static byte[]toPrimitive(Byte[] array) Converts an array of object Bytes to primitives.static double[]toPrimitive(Double[] array) Converts an array of object Doubles to primitives.static float[]toPrimitive(Float[] array) Converts an array of object Floats to primitives.static int[]toPrimitive(Integer[] array) Converts an array of object Integers to primitives.static long[]toPrimitive(Long[] array) Converts an array of object Longs to primitives.static short[]toPrimitive(Short[] array) Converts an array of object Shorts to primitives.toUnmodifiableIntList(int[] ints) toUnmodifiableLongList(long[] longs) 
- 
Field Details- 
EMPTY_BOOLEAN_ARRAYpublic static final boolean[] EMPTY_BOOLEAN_ARRAY
- 
EMPTY_BYTE_ARRAYpublic static final byte[] EMPTY_BYTE_ARRAY
- 
EMPTY_SHORT_ARRAYpublic static final short[] EMPTY_SHORT_ARRAY
- 
EMPTY_INT_ARRAYpublic static final int[] EMPTY_INT_ARRAY
- 
EMPTY_LONG_ARRAYpublic static final long[] EMPTY_LONG_ARRAY
- 
EMPTY_FLOAT_ARRAYpublic static final float[] EMPTY_FLOAT_ARRAY
- 
EMPTY_DOUBLE_ARRAYpublic static final double[] EMPTY_DOUBLE_ARRAY
 
- 
- 
Method Details- 
toIntList
- 
toUnmodifiableIntList
- 
toIntArray
- 
toLongList
- 
toUnmodifiableLongList
- 
toLongArray
- 
toPrimitiveConverts an array of object Booleans to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Booleanarray, may be- null
- Returns:
- a booleanarray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
toPrimitiveConverts an array of object Bytes to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Bytearray, may be- null
- Returns:
- a bytearray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
toPrimitiveConverts an array of object Shorts to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Shortarray, may be- null
- Returns:
- a bytearray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
toPrimitiveConverts an array of object Integers to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Integerarray, may be- null
- Returns:
- an intarray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
toPrimitiveConverts an array of object Longs to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Longarray, may be- null
- Returns:
- a longarray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
toPrimitiveConverts an array of object Floats to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Floatarray, may be- null
- Returns:
- a floatarray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
toPrimitiveConverts an array of object Doubles to primitives.This method returns nullfor anullinput array.This code is borrowed from `org.apache.commons:commons-lang3`. - Parameters:
- array- a- Doublearray, may be- null
- Returns:
- a doublearray,nullif null array input
- Throws:
- NullPointerException- if array content is- null
 
- 
addpublic static <T> T[] add(T[] array, T element) Copies the given array and adds the given element at the end of the new array.The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array. If the input array is null, a new one element array is returned whose component type is the same as the element, unless the element itself is null, in which case the return type is Object[]ArrayUtils.add(null, null) = IllegalArgumentException ArrayUtils.add(null, "a") = ["a"] ArrayUtils.add(["a"], null) = ["a", null] ArrayUtils.add(["a"], "b") = ["a", "b"] ArrayUtils.add(["a", "b"], "c") = ["a", "b", "c"] This code is borrowed from `org.apache.commons:commons-lang3`.- Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to "add" the element to, may be- null
- element- the object to add, may be- null
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element. If both are null, an IllegalArgumentException is thrown
- Throws:
- IllegalArgumentException- if both arguments are null
- Since:
- 2.1
 
- 
isStrictlyAscendingpublic static boolean isStrictlyAscending(long[] array) 
- 
concat
 
-