Package com.helger.commons.collection
Class ArrayHelper
- java.lang.Object
-
- com.helger.commons.collection.ArrayHelper
-
@Immutable public final class ArrayHelper extends Object
Provides additional helper methods for array handling.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static boolean[]EMPTY_BOOLEAN_ARRAYConstant empty boolean arraystatic Boolean[]EMPTY_BOOLEAN_OBJ_ARRAYConstant empty boolean arraystatic byte[]EMPTY_BYTE_ARRAYConstant empty byte arraystatic Byte[]EMPTY_BYTE_OBJ_ARRAYConstant empty byte arraystatic char[]EMPTY_CHAR_ARRAYConstant empty char arraystatic Character[]EMPTY_CHAR_OBJ_ARRAYConstant empty char arraystatic Class<?>[]EMPTY_CLASS_ARRAYConstant empty Class<?static double[]EMPTY_DOUBLE_ARRAYConstant empty double arraystatic Double[]EMPTY_DOUBLE_OBJ_ARRAYConstant empty double arraystatic float[]EMPTY_FLOAT_ARRAYConstant empty float arraystatic Float[]EMPTY_FLOAT_OBJ_ARRAYConstant empty float arraystatic int[]EMPTY_INT_ARRAYConstant empty int arraystatic Integer[]EMPTY_INT_OBJ_ARRAYConstant empty int arraystatic long[]EMPTY_LONG_ARRAYConstant empty long arraystatic Long[]EMPTY_LONG_OBJ_ARRAYConstant empty long arraystatic Object[]EMPTY_OBJECT_ARRAYConstant empty Object arraystatic short[]EMPTY_SHORT_ARRAYConstant empty short arraystatic Short[]EMPTY_SHORT_OBJ_ARRAYConstant empty short arraystatic String[]EMPTY_STRING_ARRAYConstant empty String array
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontains(boolean[] aValues, boolean aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(byte[] aValues, byte aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(char[] aValues, char aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(double[] aValues, double aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(float[] aValues, float aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(int[] aValues, int aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(long[] aValues, long aSearchValue)Check if the passed search value is contained in the passed value array.static booleancontains(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> booleancontainsAnyNullElement(T[] aArray)Check if the passed array contains at least onenullelement.static <T> booleancontainsOnlyNullElements(T[] aArray)Check if the passed array contains onlynullelement.static <ELEMENTTYPE>
ELEMENTTYPEfindFirst(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter)static <ELEMENTTYPE>
ELEMENTTYPEfindFirst(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, ELEMENTTYPE aDefault)static <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>
voidforEach(ELEMENTTYPE[] aArray, Consumer<? super ELEMENTTYPE> aConsumer)static <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>
intgetCount(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter)static booleangetFirst(boolean[] aArray, boolean aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static bytegetFirst(byte[] aArray, byte aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static chargetFirst(char[] aArray, char aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static doublegetFirst(double[] aArray, double aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static floatgetFirst(float[] aArray, float aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static intgetFirst(int[] aArray, int aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static longgetFirst(long[] aArray, long aDefaultValue)Get the first element of the array or the passed default if the passed array is empty.static shortgetFirst(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 ornullif 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 intgetFirstIndex(boolean[] aValues, boolean aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(byte[] aValues, byte aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(char[] aValues, char aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(double[] aValues, double aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(float[] aValues, float aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(int[] aValues, int aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(long[] aValues, long aSearchValue)Get the index of the passed search value in the passed value array.static intgetFirstIndex(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 booleangetLast(boolean[] aArray, boolean aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static bytegetLast(byte[] aArray, byte aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static chargetLast(char[] aArray, char aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static doublegetLast(double[] aArray, double aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static floatgetLast(float[] aArray, float aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static intgetLast(int[] aArray, int aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static longgetLast(long[] aArray, long aDefaultValue)Get the last element of the array or the passed default if the passed array is empty.static shortgetLast(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 ornullif 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 intgetLastIndex(boolean[] aValues, boolean aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(byte[] aValues, byte aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(char[] aValues, char aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(double[] aValues, double aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(float[] aValues, float aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(int[] aValues, int aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(long[] aValues, long aSearchValue)Get the index of the passed search value in the passed value array.static intgetLastIndex(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 intgetSize(boolean... aArray)static intgetSize(byte... aArray)static intgetSize(char... aArray)static intgetSize(double... aArray)static intgetSize(float... aArray)static intgetSize(int... aArray)static intgetSize(long... aArray)static intgetSize(short... aArray)static <ELEMENTTYPE>
intgetSize(ELEMENTTYPE... aArray)static booleanisArray(Object aObject)Check if the passed object is an array or not.static booleanisArrayEquals(Object aHeadArray, Object aTailArray)Recursive equal comparison for arrays.static booleanisEmpty(boolean... aArray)static booleanisEmpty(byte... aArray)static booleanisEmpty(char... aArray)static booleanisEmpty(double... aArray)static booleanisEmpty(float... aArray)static booleanisEmpty(int... aArray)static booleanisEmpty(long... aArray)static booleanisEmpty(short... aArray)static <ELEMENTTYPE>
booleanisEmpty(ELEMENTTYPE... aArray)static booleanisNotEmpty(boolean... aArray)static booleanisNotEmpty(byte... aArray)static booleanisNotEmpty(char... aArray)static booleanisNotEmpty(double... aArray)static booleanisNotEmpty(float... aArray)static booleanisNotEmpty(int... aArray)static booleanisNotEmpty(long... aArray)static booleanisNotEmpty(short... aArray)static <ELEMENTTYPE>
booleanisNotEmpty(ELEMENTTYPE... aArray)static <ELEMENTTYPE>
ELEMENTTYPE[]newArray(int nArraySize, ELEMENTTYPE aValue, Class<ELEMENTTYPE> aClass)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[]newArray(Class<? extends ELEMENTTYPE> aClass, int nSize)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 booleanstartsWith(byte[] aArray, byte[] aSearch)static booleanstartsWith(byte[] aArray, byte[] aSearch, int nSearchOfs, int nSearchLen)static booleanstartsWith(byte[] aArray, int nArrayLen, byte[] aSearch)static booleanstartsWith(byte[] aArray, int nArrayLen, byte[] aSearch, int nSearchOfs, int nSearchLen)static booleanstartsWith(byte[] aArray, int nArrayOfs, int nArrayLen, byte[] aSearch, int nSearchOfs, int nSearchLen)static booleanstartsWith(char[] aArray, char[] aSearch)static booleanstartsWith(char[] aArray, char[] aSearch, int nSearchOfs, int nSearchLen)static booleanstartsWith(char[] aArray, int nArrayLen, char[] aSearch)static booleanstartsWith(char[] aArray, int nArrayLen, char[] aSearch, int nSearchOfs, int nSearchLen)static booleanstartsWith(char[] aArray, int nArrayOfs, int nArrayLen, char[] aSearch, int nSearchOfs, int nSearchLen)
-
-
-
Field Detail
-
EMPTY_BOOLEAN_ARRAY
public static final boolean[] EMPTY_BOOLEAN_ARRAY
Constant empty boolean array
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
Constant empty byte array
-
EMPTY_CHAR_ARRAY
public static final char[] EMPTY_CHAR_ARRAY
Constant empty char array
-
EMPTY_DOUBLE_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAY
Constant empty double array
-
EMPTY_FLOAT_ARRAY
public static final float[] EMPTY_FLOAT_ARRAY
Constant empty float array
-
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAY
Constant empty int array
-
EMPTY_LONG_ARRAY
public static final long[] EMPTY_LONG_ARRAY
Constant empty long array
-
EMPTY_SHORT_ARRAY
public static final short[] EMPTY_SHORT_ARRAY
Constant empty short array
-
EMPTY_BOOLEAN_OBJ_ARRAY
public static final Boolean[] EMPTY_BOOLEAN_OBJ_ARRAY
Constant empty boolean array
-
EMPTY_BYTE_OBJ_ARRAY
public static final Byte[] EMPTY_BYTE_OBJ_ARRAY
Constant empty byte array
-
EMPTY_CHAR_OBJ_ARRAY
public static final Character[] EMPTY_CHAR_OBJ_ARRAY
Constant empty char array
-
EMPTY_DOUBLE_OBJ_ARRAY
public static final Double[] EMPTY_DOUBLE_OBJ_ARRAY
Constant empty double array
-
EMPTY_FLOAT_OBJ_ARRAY
public static final Float[] EMPTY_FLOAT_OBJ_ARRAY
Constant empty float array
-
EMPTY_INT_OBJ_ARRAY
public static final Integer[] EMPTY_INT_OBJ_ARRAY
Constant empty int array
-
EMPTY_LONG_OBJ_ARRAY
public static final Long[] EMPTY_LONG_OBJ_ARRAY
Constant empty long array
-
EMPTY_SHORT_OBJ_ARRAY
public static final Short[] EMPTY_SHORT_OBJ_ARRAY
Constant empty short array
-
EMPTY_OBJECT_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
Constant empty Object array
-
EMPTY_STRING_ARRAY
public static final String[] EMPTY_STRING_ARRAY
Constant empty String array
-
EMPTY_CLASS_ARRAY
public static final Class<?>[] EMPTY_CLASS_ARRAY
Constant empty Class<?> array
-
-
Method Detail
-
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
public static boolean isArray(@Nullable Object aObject)
Check if the passed object is an array or not.- Parameters:
aObject- The object to be checked. May benull.- Returns:
trueif the passed object is notnulland represents an array.
-
getSize
@Nonnegative public static int getSize(@Nullable boolean... aArray)
- 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
@Nonnegative public static int getSize(@Nullable byte... aArray)
- 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
@Nonnegative public static int getSize(@Nullable char... aArray)
- 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
@Nonnegative public static int getSize(@Nullable double... aArray)
- 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
@Nonnegative public static int getSize(@Nullable float... aArray)
- 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
@Nonnegative public static int getSize(@Nullable int... aArray)
- 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
@Nonnegative public static int getSize(@Nullable long... aArray)
- 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
@Nonnegative public static int getSize(@Nullable short... aArray)
- 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
@Nonnegative @SafeVarargs public static <ELEMENTTYPE> int getSize(@Nullable ELEMENTTYPE... aArray)
- 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
public static boolean isEmpty(@Nullable boolean... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable byte... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable char... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable double... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable float... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable int... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable long... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
public static boolean isEmpty(@Nullable short... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
@SafeVarargs public static <ELEMENTTYPE> boolean isEmpty(@Nullable ELEMENTTYPE... aArray)
- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable boolean... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable byte... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable char... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable double... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable float... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable int... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable long... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
public static boolean isNotEmpty(@Nullable short... aArray)
- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
@SafeVarargs public static <ELEMENTTYPE> boolean isNotEmpty(@Nullable ELEMENTTYPE... aArray)
- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor 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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable boolean[] aValues, boolean aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable byte[] aValues, byte aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable char[] aValues, char aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable double[] aValues, double aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable float[] aValues, float aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable int[] aValues, int aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable long[] aValues, long aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getFirstIndex
public static int getFirstIndex(@Nullable short[] aValues, short aSearchValue)
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:
-1if 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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable boolean[] aValues, boolean aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable byte[] aValues, byte aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable char[] aValues, char aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable double[] aValues, double aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable float[] aValues, float aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable int[] aValues, int aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable long[] aValues, long aSearchValue)
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:
-1if the searched value is not contained, a value ≥ 0 otherwise.
-
getLastIndex
public static int getLastIndex(@Nullable short[] aValues, short aSearchValue)
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:
-1if 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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable boolean[] aValues, boolean aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable byte[] aValues, byte aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable char[] aValues, char aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable double[] aValues, double aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable float[] aValues, float aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable int[] aValues, int aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable long[] aValues, long aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
contains
public static boolean contains(@Nullable short[] aValues, short aSearchValue)
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:
trueif the value array is not empty and the search value is contained - false otherwise.
-
getFirst
public static boolean getFirst(@Nullable boolean[] aArray, boolean aDefaultValue)
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 benullor 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
public static byte getFirst(@Nullable byte[] aArray, byte aDefaultValue)
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 benullor 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
public static char getFirst(@Nullable char[] aArray, char aDefaultValue)
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 benullor 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
public static double getFirst(@Nullable double[] aArray, double aDefaultValue)
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 benullor 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
public static float getFirst(@Nullable float[] aArray, float aDefaultValue)
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 benullor 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
public static int getFirst(@Nullable int[] aArray, int aDefaultValue)
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 benullor 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
public static long getFirst(@Nullable long[] aArray, long aDefaultValue)
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 benullor 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
public static short getFirst(@Nullable short[] aArray, short aDefaultValue)
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 benullor 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 ornullif the passed array is empty.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array who's first element is to be retrieved. May benullor empty.- Returns:
nullif the passed array isnullor 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 benullor 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
public static boolean getLast(@Nullable boolean[] aArray, boolean aDefaultValue)
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 benullor 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
public static byte getLast(@Nullable byte[] aArray, byte aDefaultValue)
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 benullor 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
public static char getLast(@Nullable char[] aArray, char aDefaultValue)
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 benullor 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
public static double getLast(@Nullable double[] aArray, double aDefaultValue)
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 benullor 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
public static float getLast(@Nullable float[] aArray, float aDefaultValue)
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 benullor 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
public static int getLast(@Nullable int[] aArray, int aDefaultValue)
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 benullor 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
public static long getLast(@Nullable long[] aArray, long aDefaultValue)
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 benullor 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
public static short getLast(@Nullable short[] aArray, short aDefaultValue)
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 benullor 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 ornullif the passed array is empty.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array who's last element is to be retrieved. May benullor empty.- Returns:
nullif the passed array isnullor 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 benullor 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
@Nullable @ReturnsMutableCopy public static boolean[] getCopy(@Nullable boolean... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
getCopy
@Nullable @ReturnsMutableCopy public static byte[] getCopy(@Nullable byte... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
getCopy
@Nullable @ReturnsMutableCopy public static char[] getCopy(@Nullable char... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
getCopy
@Nullable @ReturnsMutableCopy public static double[] getCopy(@Nullable double... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
getCopy
@Nullable @ReturnsMutableCopy public static float[] getCopy(@Nullable float... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
getCopy
@Nullable @ReturnsMutableCopy public static int[] getCopy(@Nullable int... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.
-
getCopy
@Nullable @ReturnsMutableCopy public static long[] getCopy(@Nullable long... aArray)
-
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
getCopy
@Nullable @ReturnsMutableCopy public static short[] getCopy(@Nullable short... aArray)
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy 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:
nullif the passed array isnull- a non-nullcopy otherwise.- See Also:
System.arraycopy(Object, int, Object, int, int)
-
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:
nullif both array parameters arenull- a non-nullarray 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 isnullit 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 arenullthere would be no way to create a new array. May not benull.- Returns:
nullif both array parameters arenull- a non-nullarray 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 isnullit will be inserted as such into the array!aClass- The element class. Must be present, because in case both elements arenullthere would be no way to create a new array. May not benull.- Returns:
nullif both array parameters arenull- a non-nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif both array parameters arenull- a non-nullarray 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-
nullarray 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-
nullarray 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:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnull. The original array, if no elements need to be skipped. A non-nullcopy 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:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static byte[] getAllExceptFirst(@Nullable byte... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static char[] getAllExceptFirst(@Nullable char... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static double[] getAllExceptFirst(@Nullable double... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static float[] getAllExceptFirst(@Nullable float... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static int[] getAllExceptFirst(@Nullable int... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static long[] getAllExceptFirst(@Nullable long... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the first elements otherwise.
-
getAllExceptFirst
@Nullable @ReturnsMutableCopy public static short[] getAllExceptFirst(@Nullable short... aArray)
Get an array that contains all elements, except for the first element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy 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:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static boolean[] getAllExceptLast(@Nullable boolean... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static byte[] getAllExceptLast(@Nullable byte... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static char[] getAllExceptLast(@Nullable char... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static double[] getAllExceptLast(@Nullable double... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static float[] getAllExceptLast(@Nullable float... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static int[] getAllExceptLast(@Nullable int... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static long[] getAllExceptLast(@Nullable long... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy of the array without the last elements otherwise.
-
getAllExceptLast
@Nullable @ReturnsMutableCopy public static short[] getAllExceptLast(@Nullable short... aArray)
Get an array that contains all elements, except for the last element.- Parameters:
aArray- The source array. May benull.- Returns:
nullif the passed array isnullor has less than one element. A non-nullcopy 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:
nullif the passed array isnullor has ≤ elements than elements to be skipped. A non-nullcopy 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.
nullif 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.
nullif 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.
nullif 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.
nullif 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.
nullif 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.
nullif 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.
nullif 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.
nullif 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:
nullif the passed collection is empty, a non-nullarray 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 isnullthere 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
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> DSTTYPE[] newArrayMapped(@Nullable SRCTYPE[] aArray, @Nonnull Function<? super SRCTYPE,? extends DSTTYPE> aMapper, @Nonnull Class<DSTTYPE> aDstClass)
-
getAsObjectArray
@Nullable @ReturnsMutableCopy public static Object[] getAsObjectArray(@Nullable Collection<?> aCollection)
Get the passed collection as an array of Object. If the passed collection isnullor empty, an empty array is returned.- Parameters:
aCollection- The collection to be converted. May benull.- Returns:
- Never
null.
-
getSafeElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex)
-
getSafeElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex, @Nullable ELEMENTTYPE aDefault)
-
isArrayEquals
public static boolean isArrayEquals(@Nullable Object aHeadArray, @Nullable Object aTailArray)
Recursive equal comparison for arrays.- Parameters:
aHeadArray- First array. May benull.aTailArray- Second array. May benull.- Returns:
trueonly if the arrays and all contained elements are recursively equal.
-
containsAnyNullElement
public static <T> boolean containsAnyNullElement(@Nullable T[] aArray)
Check if the passed array contains at least onenullelement.- Type Parameters:
T- element type- Parameters:
aArray- The array to check. May benull.- Returns:
trueonly if the passed array is neithernullnor empty and if at least onenullelement is contained.
-
containsOnlyNullElements
public static <T> boolean containsOnlyNullElements(@Nullable T[] aArray)
Check if the passed array contains onlynullelement.- Type Parameters:
T- element type- Parameters:
aArray- The array to check. May benull.- Returns:
trueonly if the passed array is neithernullnor empty and if at least onenullelement is contained.
-
findFirst
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE findFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter)
-
findFirst
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE findFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nullable ELEMENTTYPE aDefault)
-
findFirstMapped
@Nullable public static <ELEMENTTYPE,RETTYPE> RETTYPE findFirstMapped(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nonnull Function<? super ELEMENTTYPE,RETTYPE> aMapper)
-
findFirstMapped
@Nullable public static <ELEMENTTYPE,RETTYPE> RETTYPE findFirstMapped(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nonnull Function<? super ELEMENTTYPE,RETTYPE> aMapper, @Nullable RETTYPE aDefault)
-
getCount
@Nonnegative public static <ELEMENTTYPE> int getCount(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter)
-
containsAny
public static <ELEMENTTYPE> boolean containsAny(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter)
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @Nonnull Consumer<? super ELEMENTTYPE> aConsumer)
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @Nonnull ObjIntConsumer<? super ELEMENTTYPE> aConsumer)
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nonnull Consumer<? super ELEMENTTYPE> aConsumer)
-
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
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)
-
-