Package com.helger.commons.collection
Class ArrayHelper
java.lang.Object
com.helger.commons.collection.ArrayHelper
Provides additional helper methods for array handling.
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean[]
Constant empty boolean arraystatic final Boolean[]
Constant empty boolean arraystatic final byte[]
Constant empty byte arraystatic final Byte[]
Constant empty byte arraystatic final char[]
Constant empty char arraystatic final Character[]
Constant empty char arraystatic final Class<?>[]
Constant empty Class<?static final double[]
Constant empty double arraystatic final Double[]
Constant empty double arraystatic final float[]
Constant empty float arraystatic final Float[]
Constant empty float arraystatic final int[]
Constant empty int arraystatic final Integer[]
Constant empty int arraystatic final long[]
Constant empty long arraystatic final Long[]
Constant empty long arraystatic final Object[]
Constant empty Object arraystatic final short[]
Constant empty short arraystatic final Short[]
Constant empty short arraystatic final String[]
Constant empty String array -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
contains
(boolean[] aValues, boolean aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(byte[] aValues, byte aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(char[] aValues, char aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(double[] aValues, double aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(float[] aValues, float aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(int[] aValues, int aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(long[] aValues, long aSearchValue) Check if the passed search value is contained in the passed value array.static boolean
contains
(short[] aValues, short aSearchValue) Check if the passed search value is contained in the passed value array.static <ELEMENTTYPE>
booleancontains
(ELEMENTTYPE[] aValues, ELEMENTTYPE aSearchValue) Check if the passed search value is contained in the passed value array.static <ELEMENTTYPE>
booleancontainsAny
(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter) static <T> boolean
containsAnyNullElement
(T[] aArray) Check if the passed array contains at least onenull
element.static <T> boolean
containsOnlyNullElements
(T[] aArray) Check if the passed array contains onlynull
element.static <ELEMENTTYPE>
ELEMENTTYPEstatic <ELEMENTTYPE>
ELEMENTTYPEstatic <ELEMENTTYPE,
RETTYPE>
RETTYPEfindFirstMapped
(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE, RETTYPE> aMapper) static <ELEMENTTYPE,
RETTYPE>
RETTYPEfindFirstMapped
(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE, RETTYPE> aMapper, RETTYPE aDefault) static <ELEMENTTYPE>
voidstatic <ELEMENTTYPE>
voidforEach
(ELEMENTTYPE[] aArray, ObjIntConsumer<? super ELEMENTTYPE> aConsumer) static <ELEMENTTYPE>
voidforEach
(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, Consumer<? super ELEMENTTYPE> aConsumer) static boolean[]
getAllExcept
(boolean[] aArray, boolean... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static byte[]
getAllExcept
(byte[] aArray, byte... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static char[]
getAllExcept
(char[] aArray, char... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static double[]
getAllExcept
(double[] aArray, double... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static float[]
getAllExcept
(float[] aArray, float... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static int[]
getAllExcept
(int[] aArray, int... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static long[]
getAllExcept
(long[] aArray, long... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static short[]
getAllExcept
(short[] aArray, short... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static <ELEMENTTYPE>
ELEMENTTYPE[]getAllExcept
(ELEMENTTYPE[] aArray, ELEMENTTYPE... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static boolean[]
getAllExceptFirst
(boolean... aArray) Get an array that contains all elements, except for the first element.static boolean[]
getAllExceptFirst
(boolean[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static byte[]
getAllExceptFirst
(byte... aArray) Get an array that contains all elements, except for the first element.static byte[]
getAllExceptFirst
(byte[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static char[]
getAllExceptFirst
(char... aArray) Get an array that contains all elements, except for the first element.static char[]
getAllExceptFirst
(char[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static double[]
getAllExceptFirst
(double... aArray) Get an array that contains all elements, except for the first element.static double[]
getAllExceptFirst
(double[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static float[]
getAllExceptFirst
(float... aArray) Get an array that contains all elements, except for the first element.static float[]
getAllExceptFirst
(float[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static int[]
getAllExceptFirst
(int... aArray) Get an array that contains all elements, except for the first element.static int[]
getAllExceptFirst
(int[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static long[]
getAllExceptFirst
(long... aArray) Get an array that contains all elements, except for the first element.static long[]
getAllExceptFirst
(long[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static short[]
getAllExceptFirst
(short... aArray) Get an array that contains all elements, except for the first element.static short[]
getAllExceptFirst
(short[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static <ELEMENTTYPE>
ELEMENTTYPE[]getAllExceptFirst
(ELEMENTTYPE... aArray) Get an array that contains all elements, except for the first element.static <ELEMENTTYPE>
ELEMENTTYPE[]getAllExceptFirst
(ELEMENTTYPE[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static boolean[]
getAllExceptLast
(boolean... aArray) Get an array that contains all elements, except for the last element.static boolean[]
getAllExceptLast
(boolean[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static byte[]
getAllExceptLast
(byte... aArray) Get an array that contains all elements, except for the last element.static byte[]
getAllExceptLast
(byte[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static char[]
getAllExceptLast
(char... aArray) Get an array that contains all elements, except for the last element.static char[]
getAllExceptLast
(char[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static double[]
getAllExceptLast
(double... aArray) Get an array that contains all elements, except for the last element.static double[]
getAllExceptLast
(double[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static float[]
getAllExceptLast
(float... aArray) Get an array that contains all elements, except for the last element.static float[]
getAllExceptLast
(float[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static int[]
getAllExceptLast
(int... aArray) Get an array that contains all elements, except for the last element.static int[]
getAllExceptLast
(int[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static long[]
getAllExceptLast
(long... aArray) Get an array that contains all elements, except for the last element.static long[]
getAllExceptLast
(long[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static short[]
getAllExceptLast
(short... aArray) Get an array that contains all elements, except for the last element.static short[]
getAllExceptLast
(short[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static <ELEMENTTYPE>
ELEMENTTYPE[]getAllExceptLast
(ELEMENTTYPE... aArray) Get an array that contains all elements, except for the last element.static <ELEMENTTYPE>
ELEMENTTYPE[]getAllExceptLast
(ELEMENTTYPE[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static Object[]
getAsObjectArray
(Collection<?> aCollection) Get the passed collection as an array of Object.static <ELEMENTTYPE>
Class<? extends ELEMENTTYPE> getComponentType
(ELEMENTTYPE[] aArray) Get the component type of the array (the type of which the array is made up)static boolean[]
getConcatenated
(boolean[] aHeadArray, boolean aTail) Get a new array that combines the passed array and the tail element.static boolean[]
getConcatenated
(boolean[] aHeadArray, boolean... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static boolean[]
getConcatenated
(boolean aHead, boolean... aTailArray) Get a new array that combines the passed head element and the array.static byte[]
getConcatenated
(byte[] aHeadArray, byte aTail) Get a new array that combines the passed array and the tail element.static byte[]
getConcatenated
(byte[] aHeadArray, byte... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static byte[]
getConcatenated
(byte aHead, byte... aTailArray) Get a new array that combines the passed head element and the array.static char[][]
getConcatenated
(char[][] aHeadArray, char[]... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static char[]
getConcatenated
(char[] aHeadArray, char aTail) Get a new array that combines the passed array and the tail element.static char[]
getConcatenated
(char[] aHeadArray, char... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static char[]
getConcatenated
(char aHead, char... aTailArray) Get a new array that combines the passed head element and the array.static double[]
getConcatenated
(double[] aHeadArray, double aTail) Get a new array that combines the passed array and the tail element.static double[]
getConcatenated
(double[] aHeadArray, double... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static double[]
getConcatenated
(double aHead, double... aTailArray) Get a new array that combines the passed head element and the array.static float[]
getConcatenated
(float[] aHeadArray, float aTail) Get a new array that combines the passed array and the tail element.static float[]
getConcatenated
(float[] aHeadArray, float... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static float[]
getConcatenated
(float aHead, float... aTailArray) Get a new array that combines the passed head element and the array.static int[]
getConcatenated
(int[] aHeadArray, int aTail) Get a new array that combines the passed array and the tail element.static int[]
getConcatenated
(int[] aHeadArray, int... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static int[]
getConcatenated
(int aHead, int... aTailArray) Get a new array that combines the passed head element and the array.static long[]
getConcatenated
(long[] aHeadArray, long aTail) Get a new array that combines the passed array and the tail element.static long[]
getConcatenated
(long[] aHeadArray, long... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static long[]
getConcatenated
(long aHead, long... aTailArray) Get a new array that combines the passed head element and the array.static short[]
getConcatenated
(short[] aHeadArray, short aTail) Get a new array that combines the passed array and the tail element.static short[]
getConcatenated
(short[] aHeadArray, short... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static short[]
getConcatenated
(short aHead, short... aTailArray) Get a new array that combines the passed head element and the array.static <ELEMENTTYPE>
ELEMENTTYPE[]getConcatenated
(ELEMENTTYPE[] aHeadArray, ELEMENTTYPE[] aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static <ELEMENTTYPE>
ELEMENTTYPE[]getConcatenated
(ELEMENTTYPE[] aHeadArray, ELEMENTTYPE aTail, Class<ELEMENTTYPE> aClass) Get a new array that combines the passed array and the tail element.static <ELEMENTTYPE>
ELEMENTTYPE[]getConcatenated
(ELEMENTTYPE aHead, ELEMENTTYPE[] aTailArray, Class<ELEMENTTYPE> aClass) Get a new array that combines the passed head and the array.static String[]
getConcatenated
(String[] aHeadArray, String aTail) Get a new array that combines the passed array and the tail element.static String[]
getConcatenated
(String[] aHeadArray, String... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static String[]
getConcatenated
(String aHead, String... aTailArray) Get a new array that combines the passed head element and the array.static boolean[]
getCopy
(boolean... aArray) Get a 1:1 copy of the passed array.static boolean[]
getCopy
(boolean[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static boolean[]
getCopy
(boolean[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static byte[]
getCopy
(byte... aArray) Get a 1:1 copy of the passed array.static byte[]
getCopy
(byte[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static byte[]
getCopy
(byte[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static char[]
getCopy
(char... aArray) Get a 1:1 copy of the passed array.static char[]
getCopy
(char[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static char[]
getCopy
(char[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static double[]
getCopy
(double... aArray) Get a 1:1 copy of the passed array.static double[]
getCopy
(double[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static double[]
getCopy
(double[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static float[]
getCopy
(float... aArray) Get a 1:1 copy of the passed array.static float[]
getCopy
(float[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static float[]
getCopy
(float[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static int[]
getCopy
(int... aArray) Get a 1:1 copy of the passed array.static int[]
getCopy
(int[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static int[]
getCopy
(int[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array.static long[]
getCopy
(long... aArray) static long[]
getCopy
(long[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static long[]
getCopy
(long[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static short[]
getCopy
(short... aArray) Get a 1:1 copy of the passed array.static short[]
getCopy
(short[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static short[]
getCopy
(short[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static <ELEMENTTYPE>
ELEMENTTYPE[]getCopy
(ELEMENTTYPE... aArray) Get a 1:1 copy of the passed array.static <ELEMENTTYPE>
ELEMENTTYPE[]getCopy
(ELEMENTTYPE[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static <ELEMENTTYPE>
ELEMENTTYPE[]getCopy
(ELEMENTTYPE[] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.static <ELEMENTTYPE>
intstatic boolean
getFirst
(boolean[] aArray, boolean aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static byte
getFirst
(byte[] aArray, byte aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static char
getFirst
(char[] aArray, char aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static double
getFirst
(double[] aArray, double aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static float
getFirst
(float[] aArray, float aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static int
getFirst
(int[] aArray, int aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static long
getFirst
(long[] aArray, long aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static short
getFirst
(short[] aArray, short aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static <ELEMENTTYPE>
ELEMENTTYPEgetFirst
(ELEMENTTYPE... aArray) Get the first element of the array ornull
if the passed array is empty.static <ELEMENTTYPE>
ELEMENTTYPEgetFirst
(ELEMENTTYPE[] aArray, ELEMENTTYPE aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static int
getFirstIndex
(boolean[] aValues, boolean aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(byte[] aValues, byte aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(char[] aValues, char aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(double[] aValues, double aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(float[] aValues, float aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(int[] aValues, int aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(long[] aValues, long aSearchValue) Get the index of the passed search value in the passed value array.static int
getFirstIndex
(short[] aValues, short aSearchValue) Get the index of the passed search value in the passed value array.static <ELEMENTTYPE>
intgetFirstIndex
(ELEMENTTYPE[] aValues, ELEMENTTYPE aSearchValue) Get the index of the passed search value in the passed value array.static boolean
getLast
(boolean[] aArray, boolean aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static byte
getLast
(byte[] aArray, byte aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static char
getLast
(char[] aArray, char aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static double
getLast
(double[] aArray, double aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static float
getLast
(float[] aArray, float aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static int
getLast
(int[] aArray, int aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static long
getLast
(long[] aArray, long aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static short
getLast
(short[] aArray, short aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static <ELEMENTTYPE>
ELEMENTTYPEgetLast
(ELEMENTTYPE... aArray) Get the last element of the array ornull
if the passed array is empty.static <ELEMENTTYPE>
ELEMENTTYPEgetLast
(ELEMENTTYPE[] aArray, ELEMENTTYPE aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static int
getLastIndex
(boolean[] aValues, boolean aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(byte[] aValues, byte aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(char[] aValues, char aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(double[] aValues, double aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(float[] aValues, float aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(int[] aValues, int aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(long[] aValues, long aSearchValue) Get the index of the passed search value in the passed value array.static int
getLastIndex
(short[] aValues, short aSearchValue) Get the index of the passed search value in the passed value array.static <ELEMENTTYPE>
intgetLastIndex
(ELEMENTTYPE[] aValues, ELEMENTTYPE aSearchValue) Get the index of the passed search value in the passed value array.static <ELEMENTTYPE>
ELEMENTTYPEgetSafeElement
(ELEMENTTYPE[] aItems, int nIndex) static <ELEMENTTYPE>
ELEMENTTYPEgetSafeElement
(ELEMENTTYPE[] aItems, int nIndex, ELEMENTTYPE aDefault) static int
getSize
(boolean... aArray) static int
getSize
(byte... aArray) static int
getSize
(char... aArray) static int
getSize
(double... aArray) static int
getSize
(float... aArray) static int
getSize
(int... aArray) static int
getSize
(long... aArray) static int
getSize
(short... aArray) static <ELEMENTTYPE>
intgetSize
(ELEMENTTYPE... aArray) static boolean
Check if the passed object is an array or not.static boolean
isArrayEquals
(Object aHeadArray, Object aTailArray) Recursive equal comparison for arrays.static boolean
isEmpty
(boolean... aArray) static boolean
isEmpty
(byte... aArray) static boolean
isEmpty
(char... aArray) static boolean
isEmpty
(double... aArray) static boolean
isEmpty
(float... aArray) static boolean
isEmpty
(int... aArray) static boolean
isEmpty
(long... aArray) static boolean
isEmpty
(short... aArray) static <ELEMENTTYPE>
booleanisEmpty
(ELEMENTTYPE... aArray) static boolean
isNotEmpty
(boolean... aArray) static boolean
isNotEmpty
(byte... aArray) static boolean
isNotEmpty
(char... aArray) static boolean
isNotEmpty
(double... aArray) static boolean
isNotEmpty
(float... aArray) static boolean
isNotEmpty
(int... aArray) static boolean
isNotEmpty
(long... aArray) static boolean
isNotEmpty
(short... aArray) static <ELEMENTTYPE>
booleanisNotEmpty
(ELEMENTTYPE... aArray) static <ELEMENTTYPE>
ELEMENTTYPE[]Create a new array with a predefined number of elements containing the passed value.static <ELEMENTTYPE>
ELEMENTTYPE[]newArray
(ELEMENTTYPE... aArray) Wrapper that allows vararg arguments and returns the array.static <ELEMENTTYPE>
ELEMENTTYPE[]static <ELEMENTTYPE>
ELEMENTTYPE[]newArray
(Collection<? extends ELEMENTTYPE> aCollection, Class<ELEMENTTYPE> aClass) Create a new array with the elements in the passed collection..static <SRCTYPE,
DSTTYPE>
DSTTYPE[]newArrayMapped
(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, Class<DSTTYPE> aDstClass) static <SRCTYPE,
DSTTYPE>
DSTTYPE[]newArrayMapped
(SRCTYPE[] aArray, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, Class<DSTTYPE> aDstClass) static <ELEMENTTYPE>
ELEMENTTYPE[]newArraySameType
(ELEMENTTYPE[] aArray, int nSize) Create a new empty array with the same type as the passed array.static <ELEMENTTYPE>
ELEMENTTYPE[]newArraySingleElement
(ELEMENTTYPE aElement, Class<ELEMENTTYPE> aClass) Wrapper that allows a single argument to be treated as an array.static boolean[]
newBooleanArray
(boolean... aArray) Helper method to easily create an array from constant values.static byte[]
newByteArray
(byte... aArray) Helper method to easily create an array from constant values.static char[]
newCharArray
(char... aArray) Helper method to easily create an array from constant values.static double[]
newDoubleArray
(double... aArray) Helper method to easily create an array from constant values.static float[]
newFloatArray
(float... aArray) Helper method to easily create an array from constant values.static int[]
newIntArray
(int... aArray) Helper method to easily create an array from constant values.static long[]
newLongArray
(long... aArray) Helper method to easily create an array from constant values.static short[]
newShortArray
(short... aArray) Helper method to easily create an array from constant values.static boolean
startsWith
(byte[] aArray, byte[] aSearch) static boolean
startsWith
(byte[] aArray, byte[] aSearch, int nSearchOfs, int nSearchLen) static boolean
startsWith
(byte[] aArray, int nArrayLen, byte[] aSearch) static boolean
startsWith
(byte[] aArray, int nArrayLen, byte[] aSearch, int nSearchOfs, int nSearchLen) static boolean
startsWith
(byte[] aArray, int nArrayOfs, int nArrayLen, byte[] aSearch, int nSearchOfs, int nSearchLen) static boolean
startsWith
(char[] aArray, char[] aSearch) static boolean
startsWith
(char[] aArray, char[] aSearch, int nSearchOfs, int nSearchLen) static boolean
startsWith
(char[] aArray, int nArrayLen, char[] aSearch) static boolean
startsWith
(char[] aArray, int nArrayLen, char[] aSearch, int nSearchOfs, int nSearchLen) static boolean
startsWith
(char[] aArray, int nArrayOfs, int nArrayLen, char[] aSearch, int nSearchOfs, int nSearchLen)
-
Field Details
-
EMPTY_BOOLEAN_ARRAY
public static final boolean[] EMPTY_BOOLEAN_ARRAYConstant empty boolean array -
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAYConstant empty byte array -
EMPTY_CHAR_ARRAY
public static final char[] EMPTY_CHAR_ARRAYConstant empty char array -
EMPTY_DOUBLE_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAYConstant empty double array -
EMPTY_FLOAT_ARRAY
public static final float[] EMPTY_FLOAT_ARRAYConstant empty float array -
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAYConstant empty int array -
EMPTY_LONG_ARRAY
public static final long[] EMPTY_LONG_ARRAYConstant empty long array -
EMPTY_SHORT_ARRAY
public static final short[] EMPTY_SHORT_ARRAYConstant empty short array -
EMPTY_BOOLEAN_OBJ_ARRAY
Constant empty boolean array -
EMPTY_BYTE_OBJ_ARRAY
Constant empty byte array -
EMPTY_CHAR_OBJ_ARRAY
Constant empty char array -
EMPTY_DOUBLE_OBJ_ARRAY
Constant empty double array -
EMPTY_FLOAT_OBJ_ARRAY
Constant empty float array -
EMPTY_INT_OBJ_ARRAY
Constant empty int array -
EMPTY_LONG_OBJ_ARRAY
Constant empty long array -
EMPTY_SHORT_OBJ_ARRAY
Constant empty short array -
EMPTY_OBJECT_ARRAY
Constant empty Object array -
EMPTY_STRING_ARRAY
Constant empty String array -
EMPTY_CLASS_ARRAY
Constant empty Class<?> array
-
-
Method Details
-
getComponentType
@Nonnull public static <ELEMENTTYPE> Class<? extends ELEMENTTYPE> getComponentType(@Nonnull ELEMENTTYPE[] aArray) Get the component type of the array (the type of which the array is made up)- Type Parameters:
ELEMENTTYPE
- The component type of the array- Parameters:
aArray
- The array to get the type from. May not benull
.- Returns:
- The class that determines a single element of the array.
-
isArray
Check if the passed object is an array or not.- Parameters:
aObject
- The object to be checked. May benull
.- Returns:
true
if the passed object is notnull
and represents an array.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
getSize
- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array who's size is to be queried. May benull
.- Returns:
- 0 if the passed array is
null
- it's length otherwise.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isEmpty
- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
true
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
isNotEmpty
- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array to be queried if it is empty. May benull
.- Returns:
false
if the passed array isnull
or empty.
-
getFirstIndex
public static <ELEMENTTYPE> int getFirstIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue) Get the index of the passed search value in the passed value array.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static <ELEMENTTYPE> int getLastIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue) Get the index of the passed search value in the passed value array.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
Get the index of the passed search value in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
-1
if the searched value is not contained, a value ≥ 0 otherwise.
-
contains
public static <ELEMENTTYPE> boolean contains(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue) Check if the passed search value is contained in the passed value array.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
contains
Check if the passed search value is contained in the passed value array.- Parameters:
aValues
- The value array to be searched. May benull
.aSearchValue
- The value to be searched. May benull
.- Returns:
true
if the value array is not empty and the search value is contained - false otherwise.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
Get the first element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getFirst
@Nullable @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE getFirst(@Nullable ELEMENTTYPE... aArray) Get the first element of the array ornull
if the passed array is empty.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.- Returns:
null
if the passed array isnull
or empty - the first element otherwise (may also benull
).
-
getFirst
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable ELEMENTTYPE aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array who's first element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the first element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
Get the last element of the array or the passed default if the passed array is empty.- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getLast
@Nullable @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE getLast(@Nullable ELEMENTTYPE... aArray) Get the last element of the array ornull
if the passed array is empty.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.- Returns:
null
if the passed array isnull
or empty - the last element otherwise (may also benull
).
-
getLast
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getLast(@Nullable ELEMENTTYPE[] aArray, @Nullable ELEMENTTYPE aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array who's last element is to be retrieved. May benull
or empty.aDefaultValue
- The default value to be returned if the array is empty- Returns:
- the last element if the passed array is not empty, the default value if the passed array is empty.
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static boolean[] getCopy(@Nullable boolean[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static boolean[] getCopy(@Nullable boolean[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static byte[] getCopy(@Nullable byte[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static byte[] getCopy(@Nullable byte[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static char[] getCopy(@Nullable char[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static char[] getCopy(@Nullable char[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static double[] getCopy(@Nullable double[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static double[] getCopy(@Nullable double[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static float[] getCopy(@Nullable float[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static float[] getCopy(@Nullable float[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static int[] getCopy(@Nullable int[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static int[] getCopy(@Nullable int[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
-
getCopy
@Nullable @ReturnsMutableCopy public static long[] getCopy(@Nullable long[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static long[] getCopy(@Nullable long[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static short[] getCopy(@Nullable short[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static short[] getCopy(@Nullable short[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getCopy
@Nullable @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE[] getCopy(@Nullable ELEMENTTYPE... aArray) Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array to be copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getCopy(@Nullable ELEMENTTYPE[] aArray, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array to be copied.nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getCopy(@Nullable ELEMENTTYPE[] aArray, @Nonnegative int nStartIndex, @Nonnegative int nLength) Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The array to be copied.nStartIndex
- The index where the copying should start. Must be >= 0!nLength
- The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.- Returns:
null
if the passed array isnull
- a non-null
copy otherwise.- See Also:
-
getConcatenated
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getConcatenated(@Nullable ELEMENTTYPE[] aHeadArray, @Nullable ELEMENTTYPE[] aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getConcatenated(@Nullable ELEMENTTYPE aHead, @Nullable ELEMENTTYPE[] aTailArray, @Nonnull Class<ELEMENTTYPE> aClass) Get a new array that combines the passed head and the array. The head element will be the first element of the created array.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aHead
- The first element of the result array. If this element isnull
it will be inserted as such into the array!aTailArray
- The tail array. May benull
.aClass
- The element class. Must be present, because in case both elements arenull
there would be no way to create a new array. May not benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getConcatenated(@Nullable ELEMENTTYPE[] aHeadArray, @Nullable ELEMENTTYPE aTail, @Nonnull Class<ELEMENTTYPE> aClass) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array. If this element isnull
it will be inserted as such into the array!aClass
- The element class. Must be present, because in case both elements arenull
there would be no way to create a new array. May not benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static boolean[] getConcatenated(@Nullable boolean[] aHeadArray, @Nullable boolean... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static boolean[] getConcatenated(boolean aHead, @Nullable boolean... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static boolean[] getConcatenated(@Nullable boolean[] aHeadArray, boolean aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static byte[] getConcatenated(@Nullable byte[] aHeadArray, @Nullable byte... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static byte[] getConcatenated(byte aHead, @Nullable byte... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static byte[] getConcatenated(@Nullable byte[] aHeadArray, byte aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static char[] getConcatenated(@Nullable char[] aHeadArray, @Nullable char... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static char[][] getConcatenated(@Nullable char[][] aHeadArray, @Nullable char[]... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static char[] getConcatenated(char aHead, @Nullable char... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static char[] getConcatenated(@Nullable char[] aHeadArray, char aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static double[] getConcatenated(@Nullable double[] aHeadArray, @Nullable double... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static double[] getConcatenated(double aHead, @Nullable double... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static double[] getConcatenated(@Nullable double[] aHeadArray, double aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static float[] getConcatenated(@Nullable float[] aHeadArray, @Nullable float... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static float[] getConcatenated(float aHead, @Nullable float... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static float[] getConcatenated(@Nullable float[] aHeadArray, float aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static int[] getConcatenated(@Nullable int[] aHeadArray, @Nullable int... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static int[] getConcatenated(int aHead, @Nullable int... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static int[] getConcatenated(@Nullable int[] aHeadArray, int aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static long[] getConcatenated(@Nullable long[] aHeadArray, @Nullable long... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static long[] getConcatenated(long aHead, @Nullable long... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static long[] getConcatenated(@Nullable long[] aHeadArray, long aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nullable @ReturnsMutableCopy public static short[] getConcatenated(@Nullable short[] aHeadArray, @Nullable short... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static short[] getConcatenated(short aHead, @Nullable short... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static short[] getConcatenated(@Nullable short[] aHeadArray, short aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static String[] getConcatenated(@Nullable String[] aHeadArray, @Nullable String... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.- Parameters:
aHeadArray
- The first array. May benull
.aTailArray
- The second array. May benull
.- Returns:
null
if both array parameters arenull
- a non-null
array with all elements in the correct order otherwise.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static String[] getConcatenated(String aHead, @Nullable String... aTailArray) Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.- Parameters:
aHead
- The first element of the result array.aTailArray
- The tail array. May benull
.- Returns:
- A non-
null
array with all elements in the correct order.
-
getConcatenated
@Nonnull @ReturnsMutableCopy public static String[] getConcatenated(@Nullable String[] aHeadArray, String aTail) Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.- Parameters:
aHeadArray
- The head array. May benull
.aTail
- The last element of the result array.- Returns:
- A non-
null
array with all elements in the correct order.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptFirst(@Nullable ELEMENTTYPE... aArray) Get an array that contains all elements, except for the first element.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptFirst(@Nullable ELEMENTTYPE[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExcept(@Nullable ELEMENTTYPE[] aArray, @Nullable ELEMENTTYPE... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static boolean[] getAllExcept(@Nullable boolean[] aArray, @Nullable boolean... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static byte[] getAllExcept(@Nullable byte[] aArray, @Nullable byte... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static char[] getAllExcept(@Nullable char[] aArray, @Nullable char... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static double[] getAllExcept(@Nullable double[] aArray, @Nullable double... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static float[] getAllExcept(@Nullable float[] aArray, @Nullable float... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static int[] getAllExcept(@Nullable int[] aArray, @Nullable int... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static long[] getAllExcept(@Nullable long[] aArray, @Nullable long... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExcept
@Nullable @ReturnsMutableCopy public static short[] getAllExcept(@Nullable short[] aArray, @Nullable short... aElementsToRemove) Get an array that contains all elements, except for the passed elements.- Parameters:
aArray
- The source array. May benull
.aElementsToRemove
- The elements to skip.- Returns:
null
if the passed array isnull
. The original array, if no elements need to be skipped. A non-null
copy of the array without the passed elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static boolean[] getAllExceptFirst(@Nullable boolean... aArray) Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static boolean[] getAllExceptFirst(@Nullable boolean[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static byte[] getAllExceptFirst(@Nullable byte[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static char[] getAllExceptFirst(@Nullable char[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static double[] getAllExceptFirst(@Nullable double[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static float[] getAllExceptFirst(@Nullable float[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static int[] getAllExceptFirst(@Nullable int[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static long[] getAllExceptFirst(@Nullable long[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptFirst
Get an array that contains all elements, except for the first element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the first element otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static short[] getAllExceptFirst(@Nullable short[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the first n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the first elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptLast(@Nullable ELEMENTTYPE... aArray) Get an array that contains all elements, except for the last element.- Type Parameters:
ELEMENTTYPE
- Array element type- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptLast(@Nullable ELEMENTTYPE[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Type Parameters:
ELEMENTTYPE
- Type of element- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static boolean[] getAllExceptLast(@Nullable boolean[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static byte[] getAllExceptLast(@Nullable byte[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static char[] getAllExceptLast(@Nullable char[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static double[] getAllExceptLast(@Nullable double[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static float[] getAllExceptLast(@Nullable float[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static int[] getAllExceptLast(@Nullable int[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static long[] getAllExceptLast(@Nullable long[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
getAllExceptLast
Get an array that contains all elements, except for the last element.- Parameters:
aArray
- The source array. May benull
.- Returns:
null
if the passed array isnull
or has less than one element. A non-null
copy of the array without the last element otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static short[] getAllExceptLast(@Nullable short[] aArray, @Nonnegative int nElementsToSkip) Get an array that contains all elements, except for the last n elements.- Parameters:
aArray
- The source array. May benull
.nElementsToSkip
- The number of elements to skip. Must be >= 0!- Returns:
null
if the passed array isnull
or has ≤ elements than elements to be skipped. A non-null
copy of the array without the last elements otherwise.
-
newBooleanArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static boolean[] newBooleanArray(@Nullable boolean... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newByteArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static byte[] newByteArray(@Nullable byte... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newCharArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static char[] newCharArray(@Nullable char... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newDoubleArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static double[] newDoubleArray(@Nullable double... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newFloatArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static float[] newFloatArray(@Nullable float... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newIntArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static int[] newIntArray(@Nullable int... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newLongArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static long[] newLongArray(@Nullable long... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newShortArray
@Nullable @ReturnsMutableObject("use getCopy otherwise") public static short[] newShortArray(@Nullable short... aArray) Helper method to easily create an array from constant values.- Parameters:
aArray
- The list of values for the array. May benull
.- Returns:
- The passed array.
null
if the passed array wasnull
.
-
newArray
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] newArray(@Nonnull Class<? extends ELEMENTTYPE> aClass, @Nonnegative int nSize) -
newArraySameType
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] newArraySameType(@Nonnull ELEMENTTYPE[] aArray, @Nonnegative int nSize) Create a new empty array with the same type as the passed array.- Type Parameters:
ELEMENTTYPE
- Type of element- Parameters:
aArray
- Source array. May not benull
.nSize
- Destination size. Must be ≥ 0.- Returns:
- Never
null
.
-
newArray
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] newArray(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nonnull Class<ELEMENTTYPE> aClass) Create a new array with the elements in the passed collection..- Type Parameters:
ELEMENTTYPE
- Type of element- Parameters:
aCollection
- The collection to be converted to an array. May benull
.aClass
- The class of the elements inside the collection. May not benull
.- Returns:
null
if the passed collection is empty, a non-null
array with all elements of the collection otherwise.
-
newArraySingleElement
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] newArraySingleElement(@Nullable ELEMENTTYPE aElement, @Nonnull Class<ELEMENTTYPE> aClass) Wrapper that allows a single argument to be treated as an array.- Type Parameters:
ELEMENTTYPE
- Type of element- Parameters:
aElement
- The element to be converted to an array. May benull
.aClass
- The class of the element. May not benull
. Must be present because in case the passed element isnull
there is no way to determine the array component type!- Returns:
- The created array and never
null
.
-
newArray
@Nonnull @ReturnsMutableObject("use getCopy otherwise") @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE[] newArray(@Nonnull ELEMENTTYPE... aArray) Wrapper that allows vararg arguments and returns the array.
Note: this implementation is not available for basic types, because the Eclipse compiler seems to have difficulties resolving vararg types correctly.- Type Parameters:
ELEMENTTYPE
- Type of element- Parameters:
aArray
- The vararg array- Returns:
- The wrapped array
-
newArray
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE[] newArray(@Nonnegative int nArraySize, @Nonnull ELEMENTTYPE aValue, @Nonnull Class<ELEMENTTYPE> aClass) Create a new array with a predefined number of elements containing the passed value.- Type Parameters:
ELEMENTTYPE
- The type of the array to be created.- Parameters:
nArraySize
- The size of the array to be created.aValue
- The value to be set into each array element. May benull
.aClass
- The value class. May not benull
. Must be present in case the passed value isnull
.- Returns:
- The created array filled with the given value.
-
newArrayMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> DSTTYPE[] newArrayMapped(@Nonnull Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @Nonnull Class<DSTTYPE> aDstClass) -
newArrayMapped
-
getAsObjectArray
@Nullable @ReturnsMutableCopy public static Object[] getAsObjectArray(@Nullable Collection<?> aCollection) Get the passed collection as an array of Object. If the passed collection isnull
or empty, an empty array is returned.- Parameters:
aCollection
- The collection to be converted. May benull
.- Returns:
- Never
null
.
-
getSafeElement
-
getSafeElement
-
isArrayEquals
Recursive equal comparison for arrays.- Parameters:
aHeadArray
- First array. May benull
.aTailArray
- Second array. May benull
.- Returns:
true
only if the arrays and all contained elements are recursively equal.
-
containsAnyNullElement
Check if the passed array contains at least onenull
element.- Type Parameters:
T
- element type- Parameters:
aArray
- The array to check. May benull
.- Returns:
true
only if the passed array is neithernull
nor empty and if at least onenull
element is contained.
-
containsOnlyNullElements
Check if the passed array contains onlynull
element.- Type Parameters:
T
- element type- Parameters:
aArray
- The array to check. May benull
.- Returns:
true
only if the passed array is neithernull
nor empty and if at least onenull
element is contained.
-
findFirst
-
findFirst
-
findFirstMapped
-
findFirstMapped
-
getCount
@Nonnegative public static <ELEMENTTYPE> int getCount(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter) -
containsAny
-
forEach
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @Nonnull ObjIntConsumer<? super ELEMENTTYPE> aConsumer) -
forEach
-
startsWith
-
startsWith
public static boolean startsWith(@Nonnull byte[] aArray, @Nonnegative int nArrayLen, @Nullable byte[] aSearch) -
startsWith
public static boolean startsWith(@Nonnull byte[] aArray, @Nullable byte[] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) -
startsWith
public static boolean startsWith(@Nonnull byte[] aArray, @Nonnegative int nArrayLen, @Nullable byte[] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) -
startsWith
public static boolean startsWith(@Nonnull byte[] aArray, @Nonnegative int nArrayOfs, @Nonnegative int nArrayLen, @Nullable byte[] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) -
startsWith
-
startsWith
public static boolean startsWith(@Nonnull char[] aArray, @Nonnegative int nArrayLen, @Nullable char[] aSearch) -
startsWith
public static boolean startsWith(@Nonnull char[] aArray, @Nullable char[] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) -
startsWith
public static boolean startsWith(@Nonnull char[] aArray, @Nonnegative int nArrayLen, @Nullable char[] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) -
startsWith
public static boolean startsWith(@Nonnull char[] aArray, @Nonnegative int nArrayOfs, @Nonnegative int nArrayLen, @Nullable char[] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen)
-