Package com.helger.base.array
Class ArrayHelper
java.lang.Object
com.helger.base.array.ArrayHelper
Provides additional helper methods for array handling.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(boolean @Nullable [] aValues, boolean aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(byte @Nullable [] aValues, byte aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(char @Nullable [] aValues, char aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(double @Nullable [] aValues, double aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(float @Nullable [] aValues, float aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(int @Nullable [] aValues, int aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(long @Nullable [] aValues, long aSearchValue) Check if the passed search value is contained in the passed value array.static booleancontains(short @Nullable [] aValues, short aSearchValue) Check if the passed search value is contained in the passed value array.static <ELEMENTTYPE>
booleancontains(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue) Check if the passed search value is contained in the passed value array.static <ELEMENTTYPE>
booleancontainsAny(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Check if the passed array contains at least one element matching the provided filter.static <T> booleancontainsAnyNullElement(@Nullable T[] aArray) Check if the passed array contains at least onenullelement.static <T> booleancontainsOnlyNullElements(@Nullable T[] aArray) Check if the passed array contains onlynullelement.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]createArray(int nArraySize, @NonNull ELEMENTTYPE aValue, @NonNull Class<ELEMENTTYPE> aClass) Create a new array with a predefined number of elements containing the passed value.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]createArray(@NonNull ELEMENTTYPE... aArray) Wrapper that allows vararg arguments and returns the array.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]createArray(@NonNull Class<? extends ELEMENTTYPE> aClass, int nSize) Create a new array of the given class with the given size.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]createArray(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @NonNull Class<ELEMENTTYPE> aClass) Create a new array with the elements in the passed collection..static <SRCTYPE,DSTTYPE>
@NonNull DSTTYPE[]createArrayMapped(@Nullable SRCTYPE[] aArray, @NonNull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @NonNull Class<DSTTYPE> aDstClass) Create a new array by mapping the elements of a source array using the provided function.static <SRCTYPE,DSTTYPE>
@NonNull DSTTYPE[]createArrayMapped(@NonNull Collection<? extends SRCTYPE> aCollection, @NonNull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @NonNull Class<DSTTYPE> aDstClass) Create a new array by mapping the elements of a collection using the provided function.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]createArraySameType(@NonNull ELEMENTTYPE[] aArray, int nSize) Create a new empty array with the same type as the passed array.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]createArraySingleElement(@Nullable ELEMENTTYPE aElement, @NonNull Class<ELEMENTTYPE> aClass) Wrapper that allows a single argument to be treated as an array.static boolean @Nullable []createBooleanArray(boolean... aArray) Helper method to easily create an array from constant values.static byte @Nullable []createByteArray(byte... aArray) Helper method to easily create an array from constant values.static char @Nullable []createCharArray(char... aArray) Helper method to easily create an array from constant values.static double @Nullable []createDoubleArray(double... aArray) Helper method to easily create an array from constant values.static float @Nullable []createFloatArray(float... aArray) Helper method to easily create an array from constant values.static int @Nullable []createIntArray(int... aArray) Helper method to easily create an array from constant values.static long @Nullable []createLongArray(long... aArray) Helper method to easily create an array from constant values.static short @Nullable []createShortArray(short... aArray) Helper method to easily create an array from constant values.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEFind the first element in the array matching the provided filter.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEfindFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nullable ELEMENTTYPE aDefault) Find the first element in the array matching the provided filter.static <ELEMENTTYPE,RETTYPE>
@Nullable RETTYPEfindFirstMapped(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @NonNull Function<? super ELEMENTTYPE, RETTYPE> aMapper) Find the first element in the array matching the provided filter and apply a mapping function to it.static <ELEMENTTYPE,RETTYPE>
@Nullable RETTYPEfindFirstMapped(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @NonNull Function<? super ELEMENTTYPE, RETTYPE> aMapper, @Nullable RETTYPE aDefault) Find the first element in the array matching the provided filter and apply a mapping function to it.static <ELEMENTTYPE>
voidInvoke the provided consumer for each element of the passed array.static <ELEMENTTYPE>
voidforEach(@Nullable ELEMENTTYPE[] aArray, @NonNull ObjIntConsumer<? super ELEMENTTYPE> aConsumer) Invoke the provided consumer for each element of the passed array, providing both the element and its index.static <ELEMENTTYPE>
voidforEach(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @NonNull Consumer<? super ELEMENTTYPE> aConsumer) Invoke the provided consumer for each element of the passed array that matches the filter.static boolean @Nullable []getAllExcept(boolean @Nullable [] aArray, boolean... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static byte @Nullable []getAllExcept(byte @Nullable [] aArray, byte... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static char @Nullable []getAllExcept(char @Nullable [] aArray, char... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static double @Nullable []getAllExcept(double @Nullable [] aArray, double... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static float @Nullable []getAllExcept(float @Nullable [] aArray, float... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static int @Nullable []getAllExcept(int @Nullable [] aArray, int... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static long @Nullable []getAllExcept(long @Nullable [] aArray, long... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static short @Nullable []getAllExcept(short @Nullable [] aArray, short... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getAllExcept(@Nullable ELEMENTTYPE[] aArray, @Nullable ELEMENTTYPE... aElementsToRemove) Get an array that contains all elements, except for the passed elements.static boolean @Nullable []getAllExceptFirst(boolean... aArray) Get an array that contains all elements, except for the first element.static boolean @Nullable []getAllExceptFirst(boolean @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static byte @Nullable []getAllExceptFirst(byte... aArray) Get an array that contains all elements, except for the first element.static byte @Nullable []getAllExceptFirst(byte @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static char @Nullable []getAllExceptFirst(char... aArray) Get an array that contains all elements, except for the first element.static char @Nullable []getAllExceptFirst(char @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static double @Nullable []getAllExceptFirst(double... aArray) Get an array that contains all elements, except for the first element.static double @Nullable []getAllExceptFirst(double @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static float @Nullable []getAllExceptFirst(float... aArray) Get an array that contains all elements, except for the first element.static float @Nullable []getAllExceptFirst(float @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static int @Nullable []getAllExceptFirst(int... aArray) Get an array that contains all elements, except for the first element.static int @Nullable []getAllExceptFirst(int @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static long @Nullable []getAllExceptFirst(long... aArray) Get an array that contains all elements, except for the first element.static long @Nullable []getAllExceptFirst(long @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static short @Nullable []getAllExceptFirst(short... aArray) Get an array that contains all elements, except for the first element.static short @Nullable []getAllExceptFirst(short @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getAllExceptFirst(@Nullable ELEMENTTYPE... aArray) Get an array that contains all elements, except for the first element.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getAllExceptFirst(@Nullable ELEMENTTYPE[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the first n elements.static boolean @Nullable []getAllExceptLast(boolean... aArray) Get an array that contains all elements, except for the last element.static boolean @Nullable []getAllExceptLast(boolean @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static byte @Nullable []getAllExceptLast(byte... aArray) Get an array that contains all elements, except for the last element.static byte @Nullable []getAllExceptLast(byte @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static char @Nullable []getAllExceptLast(char... aArray) Get an array that contains all elements, except for the last element.static char @Nullable []getAllExceptLast(char @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static double @Nullable []getAllExceptLast(double... aArray) Get an array that contains all elements, except for the last element.static double @Nullable []getAllExceptLast(double @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static float @Nullable []getAllExceptLast(float... aArray) Get an array that contains all elements, except for the last element.static float @Nullable []getAllExceptLast(float @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static int @Nullable []getAllExceptLast(int... aArray) Get an array that contains all elements, except for the last element.static int @Nullable []getAllExceptLast(int @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static long @Nullable []getAllExceptLast(long... aArray) Get an array that contains all elements, except for the last element.static long @Nullable []getAllExceptLast(long @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static short @Nullable []getAllExceptLast(short... aArray) Get an array that contains all elements, except for the last element.static short @Nullable []getAllExceptLast(short @Nullable [] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getAllExceptLast(@Nullable ELEMENTTYPE... aArray) Get an array that contains all elements, except for the last element.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getAllExceptLast(@Nullable ELEMENTTYPE[] aArray, int nElementsToSkip) Get an array that contains all elements, except for the last n elements.static @Nullable Object[]getAsObjectArray(@Nullable Collection<?> aCollection) Get the passed collection as an array of Object.static <ELEMENTTYPE>
@NonNull Class<? extends ELEMENTTYPE> getComponentType(@NonNull ELEMENTTYPE[] aArray) Get the component type of the array (the type of which the array is made up)static boolean @NonNull []getConcatenated(boolean @Nullable [] aHeadArray, boolean aTail) Get a new array that combines the passed array and the tail element.static boolean @Nullable []getConcatenated(boolean @Nullable [] aHeadArray, boolean... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static boolean @NonNull []getConcatenated(boolean aHead, boolean... aTailArray) Get a new array that combines the passed head element and the array.static byte @NonNull []getConcatenated(byte @Nullable [] aHeadArray, byte aTail) Get a new array that combines the passed array and the tail element.static byte @Nullable []getConcatenated(byte @Nullable [] aHeadArray, byte... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static byte @NonNull []getConcatenated(byte aHead, byte... aTailArray) Get a new array that combines the passed head element and the array.static char[] @Nullable []getConcatenated(char[] @Nullable [] aHeadArray, char[] @Nullable ... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static char @NonNull []getConcatenated(char @Nullable [] aHeadArray, char aTail) Get a new array that combines the passed array and the tail element.static char @Nullable []getConcatenated(char @Nullable [] aHeadArray, char... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static char @NonNull []getConcatenated(char aHead, char... aTailArray) Get a new array that combines the passed head element and the array.static double @NonNull []getConcatenated(double @Nullable [] aHeadArray, double aTail) Get a new array that combines the passed array and the tail element.static double @Nullable []getConcatenated(double @Nullable [] aHeadArray, double... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static double @NonNull []getConcatenated(double aHead, double... aTailArray) Get a new array that combines the passed head element and the array.static float @NonNull []getConcatenated(float @Nullable [] aHeadArray, float aTail) Get a new array that combines the passed array and the tail element.static float @Nullable []getConcatenated(float @Nullable [] aHeadArray, float... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static float @NonNull []getConcatenated(float aHead, float... aTailArray) Get a new array that combines the passed head element and the array.static int @NonNull []getConcatenated(int @Nullable [] aHeadArray, int aTail) Get a new array that combines the passed array and the tail element.static int @Nullable []getConcatenated(int @Nullable [] aHeadArray, int... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static int @NonNull []getConcatenated(int aHead, int... aTailArray) Get a new array that combines the passed head element and the array.static long @NonNull []getConcatenated(long @Nullable [] aHeadArray, long aTail) Get a new array that combines the passed array and the tail element.static long @Nullable []getConcatenated(long @Nullable [] aHeadArray, long... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static long @NonNull []getConcatenated(long aHead, long... aTailArray) Get a new array that combines the passed head element and the array.static short @NonNull []getConcatenated(short @Nullable [] aHeadArray, short aTail) Get a new array that combines the passed array and the tail element.static short @Nullable []getConcatenated(short @Nullable [] aHeadArray, short... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static short @NonNull []getConcatenated(short aHead, short... aTailArray) Get a new array that combines the passed head element and the array.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getConcatenated(@Nullable ELEMENTTYPE[] aHeadArray, @Nullable ELEMENTTYPE[] aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static <ELEMENTTYPE>
@NonNull 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.static <ELEMENTTYPE>
@NonNull ELEMENTTYPE[]getConcatenated(@Nullable ELEMENTTYPE aHead, @Nullable ELEMENTTYPE[] aTailArray, @NonNull Class<ELEMENTTYPE> aClass) Get a new array that combines the passed head and the array.static @NonNull String[]getConcatenated(@Nullable String[] aHeadArray, @Nullable String... aTailArray) Get a new array that combines the passed two arrays, maintaining the order.static @NonNull String[]getConcatenated(@Nullable String[] aHeadArray, String aTail) Get a new array that combines the passed array and the tail element.static @NonNull String[]getConcatenated(String aHead, @Nullable String... aTailArray) Get a new array that combines the passed head element and the array.static boolean @Nullable []getCopy(boolean... aArray) Get a 1:1 copy of the passed array.static boolean @Nullable []getCopy(boolean @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static boolean @Nullable []getCopy(boolean @Nullable [] 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 @Nullable []getCopy(byte... aArray) Get a 1:1 copy of the passed array.static byte @Nullable []getCopy(byte @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static byte @Nullable []getCopy(byte @Nullable [] 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 @Nullable []getCopy(char... aArray) Get a 1:1 copy of the passed array.static char @Nullable []getCopy(char @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static char @Nullable []getCopy(char @Nullable [] 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 @Nullable []getCopy(double... aArray) Get a 1:1 copy of the passed array.static double @Nullable []getCopy(double @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static double @Nullable []getCopy(double @Nullable [] 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 @Nullable []getCopy(float... aArray) Get a 1:1 copy of the passed array.static float @Nullable []getCopy(float @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static float @Nullable []getCopy(float @Nullable [] 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 @Nullable []getCopy(int... aArray) Get a 1:1 copy of the passed array.static int @Nullable []getCopy(int @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static int @Nullable []getCopy(int @Nullable [] aArray, int nStartIndex, int nLength) Get a 1:1 copy of the passed array.static long @Nullable []getCopy(long... aArray) Get a 1:1 copy of the passed array.static long @Nullable []getCopy(long @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static long @Nullable []getCopy(long @Nullable [] 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 @Nullable []getCopy(short... aArray) Get a 1:1 copy of the passed array.static short @Nullable []getCopy(short @Nullable [] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static short @Nullable []getCopy(short @Nullable [] 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>
@Nullable ELEMENTTYPE[]getCopy(@Nullable ELEMENTTYPE... aArray) Get a 1:1 copy of the passed array.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getCopy(@Nullable ELEMENTTYPE[] aArray, int nLength) Get a 1:1 copy of the passed array using the passed number of array elements.static <ELEMENTTYPE>
@Nullable ELEMENTTYPE[]getCopy(@Nullable 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>
intCount the number of elements in the array matching the provided filter.static booleangetFirst(boolean @Nullable [] aArray, boolean aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static bytegetFirst(byte @Nullable [] aArray, byte aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static chargetFirst(char @Nullable [] aArray, char aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static doublegetFirst(double @Nullable [] aArray, double aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static floatgetFirst(float @Nullable [] aArray, float aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static intgetFirst(int @Nullable [] aArray, int aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static longgetFirst(long @Nullable [] aArray, long aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static shortgetFirst(short @Nullable [] aArray, short aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEgetFirst(@Nullable ELEMENTTYPE... aArray) Get the first element of the array ornullif the passed array is empty.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEgetFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable ELEMENTTYPE aDefaultValue) Get the first element of the array or the passed default if the passed array is empty.static intgetFirstIndex(boolean @Nullable [] aValues, boolean aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(byte @Nullable [] aValues, byte aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(char @Nullable [] aValues, char aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(double @Nullable [] aValues, double aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(float @Nullable [] aValues, float aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(int @Nullable [] aValues, int aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(long @Nullable [] aValues, long aSearchValue) Get the index of the passed search value in the passed value array.static intgetFirstIndex(short @Nullable [] aValues, short aSearchValue) Get the index of the passed search value in the passed value array.static <ELEMENTTYPE>
intgetFirstIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue) Get the index of the passed search value in the passed value array.static booleangetLast(boolean @Nullable [] aArray, boolean aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static bytegetLast(byte @Nullable [] aArray, byte aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static chargetLast(char @Nullable [] aArray, char aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static doublegetLast(double @Nullable [] aArray, double aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static floatgetLast(float @Nullable [] aArray, float aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static intgetLast(int @Nullable [] aArray, int aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static longgetLast(long @Nullable [] aArray, long aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static shortgetLast(short @Nullable [] aArray, short aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEgetLast(@Nullable ELEMENTTYPE... aArray) Get the last element of the array ornullif the passed array is empty.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEgetLast(@Nullable ELEMENTTYPE[] aArray, @Nullable ELEMENTTYPE aDefaultValue) Get the last element of the array or the passed default if the passed array is empty.static intgetLastIndex(boolean @Nullable [] aValues, boolean aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(byte @Nullable [] aValues, byte aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(char @Nullable [] aValues, char aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(double @Nullable [] aValues, double aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(float @Nullable [] aValues, float aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(int @Nullable [] aValues, int aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(long @Nullable [] aValues, long aSearchValue) Get the index of the passed search value in the passed value array.static intgetLastIndex(short @Nullable [] aValues, short aSearchValue) Get the index of the passed search value in the passed value array.static <ELEMENTTYPE>
intgetLastIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue) Get the index of the passed search value in the passed value array.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEgetSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex) Get an element from the passed array without throwing anArrayIndexOutOfBoundsException.static <ELEMENTTYPE>
@Nullable ELEMENTTYPEgetSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex, @Nullable ELEMENTTYPE aDefault) Get an element from the passed array without throwing anArrayIndexOutOfBoundsException.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(@Nullable ELEMENTTYPE... aArray) static booleanCheck if the passed object is an array or not.static booleanisArrayEquals(@Nullable Object aHeadArray, @Nullable 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(@Nullable 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(@Nullable ELEMENTTYPE... aArray) static booleanstartsWith(byte @NonNull [] aArray, byte @Nullable [] aSearch) Check if the byte array starts with the given search bytes.static booleanstartsWith(byte @NonNull [] aArray, byte @Nullable [] aSearch, int nSearchOfs, int nSearchLen) Check if the byte array starts with the given search bytes.static booleanstartsWith(byte @NonNull [] aArray, int nArrayLen, byte @Nullable [] aSearch) Check if the byte array starts with the given search bytes.static booleanstartsWith(byte @NonNull [] aArray, int nArrayLen, byte @Nullable [] aSearch, int nSearchOfs, int nSearchLen) Check if the byte array starts with the given search bytes.static booleanstartsWith(byte @NonNull [] aArray, int nArrayOfs, int nArrayLen, byte @Nullable [] aSearch, int nSearchOfs, int nSearchLen) Check if the byte array starts with the given search bytes.static booleanstartsWith(char @NonNull [] aArray, char @Nullable [] aSearch) Check if the char array starts with the given search chars.static booleanstartsWith(char @NonNull [] aArray, char @Nullable [] aSearch, int nSearchOfs, int nSearchLen) Check if the char array starts with the given search chars.static booleanstartsWith(char @NonNull [] aArray, int nArrayLen, char @Nullable [] aSearch) Check if the char array starts with the given search chars.static booleanstartsWith(char @NonNull [] aArray, int nArrayLen, char @Nullable [] aSearch, int nSearchOfs, int nSearchLen) Check if the char array starts with the given search chars.static booleanstartsWith(char @NonNull [] aArray, int nArrayOfs, int nArrayLen, char @Nullable [] aSearch, int nSearchOfs, int nSearchLen) Check if the char array starts with the given search chars.
-
Method Details
-
getComponentType
public static <ELEMENTTYPE> @NonNull 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.
-
getSize
@Nonnegative public static int getSize(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(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(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(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(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(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(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(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
- 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(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(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(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(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(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(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(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(short... aArray) - Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
trueif the passed array isnullor empty.
-
isEmpty
- 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(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(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(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(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(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(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(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(short... aArray) - Parameters:
aArray- The array to be queried if it is empty. May benull.- Returns:
falseif the passed array isnullor empty.
-
isNotEmpty
- 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.
-
createBooleanArray
@ReturnsMutableObject("use getCopy otherwise") public static boolean @Nullable [] createBooleanArray(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.
-
createByteArray
@ReturnsMutableObject("use getCopy otherwise") public static byte @Nullable [] createByteArray(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.
-
createCharArray
@ReturnsMutableObject("use getCopy otherwise") public static char @Nullable [] createCharArray(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.
-
createDoubleArray
@ReturnsMutableObject("use getCopy otherwise") public static double @Nullable [] createDoubleArray(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.
-
createFloatArray
@ReturnsMutableObject("use getCopy otherwise") public static float @Nullable [] createFloatArray(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.
-
createIntArray
@ReturnsMutableObject("use getCopy otherwise") public static int @Nullable [] createIntArray(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.
-
createLongArray
@ReturnsMutableObject("use getCopy otherwise") public static long @Nullable [] createLongArray(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.
-
createShortArray
@ReturnsMutableObject("use getCopy otherwise") public static short @Nullable [] createShortArray(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.
-
createArray
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull ELEMENTTYPE[] createArray(@NonNull Class<? extends ELEMENTTYPE> aClass, @Nonnegative int nSize) Create a new array of the given class with the given size.- Type Parameters:
ELEMENTTYPE- Type of element- Parameters:
aClass- The class of the array elements. May not benulland may not be a primitive type.nSize- The number of elements. Must be ≥ 0.- Returns:
- A new array of the given type and size. Never
null.
-
createArraySameType
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull ELEMENTTYPE[] createArraySameType(@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.
-
createArray
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull ELEMENTTYPE[] createArray(@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.
-
createArraySingleElement
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull ELEMENTTYPE[] createArraySingleElement(@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.
-
createArray
@ReturnsMutableObject("use getCopy otherwise") @SafeVarargs public static <ELEMENTTYPE> @NonNull ELEMENTTYPE[] createArray(@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
-
createArray
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull ELEMENTTYPE[] createArray(@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.
-
createArrayMapped
@ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> @NonNull DSTTYPE[] createArrayMapped(@NonNull Collection<? extends SRCTYPE> aCollection, @NonNull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @NonNull Class<DSTTYPE> aDstClass) Create a new array by mapping the elements of a collection using the provided function.- Type Parameters:
SRCTYPE- Source element typeDSTTYPE- Destination element type- Parameters:
aCollection- The source collection. May not benull.aMapper- The mapping function. May not benull.aDstClass- The destination array element class. May not benull.- Returns:
- A new array with mapped elements. Never
null.
-
createArrayMapped
@ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> @NonNull DSTTYPE[] createArrayMapped(@Nullable SRCTYPE[] aArray, @NonNull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @NonNull Class<DSTTYPE> aDstClass) Create a new array by mapping the elements of a source array using the provided function.- Type Parameters:
SRCTYPE- Source element typeDSTTYPE- Destination element type- Parameters:
aArray- The source array. May benull.aMapper- The mapping function. May not benull.aDstClass- The destination array element class. May not benull.- Returns:
- A new array with mapped elements. Never
null.
-
getCopy
@ReturnsMutableCopy public static boolean @Nullable [] getCopy(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
@ReturnsMutableCopy public static boolean @Nullable [] getCopy(boolean @Nullable [] 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
@ReturnsMutableCopy public static boolean @Nullable [] getCopy(boolean @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy public static byte @Nullable [] getCopy(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
@ReturnsMutableCopy public static byte @Nullable [] getCopy(byte @Nullable [] 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
@ReturnsMutableCopy public static byte @Nullable [] getCopy(byte @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy public static char @Nullable [] getCopy(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
@ReturnsMutableCopy public static char @Nullable [] getCopy(char @Nullable [] 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
@ReturnsMutableCopy public static char @Nullable [] getCopy(char @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy public static double @Nullable [] getCopy(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
@ReturnsMutableCopy public static double @Nullable [] getCopy(double @Nullable [] 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
@ReturnsMutableCopy public static double @Nullable [] getCopy(double @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy public static float @Nullable [] getCopy(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
@ReturnsMutableCopy public static float @Nullable [] getCopy(float @Nullable [] 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
@ReturnsMutableCopy public static float @Nullable [] getCopy(float @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy public static int @Nullable [] getCopy(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
@ReturnsMutableCopy public static int @Nullable [] getCopy(int @Nullable [] 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
@ReturnsMutableCopy public static int @Nullable [] getCopy(int @Nullable [] 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
@ReturnsMutableCopy public static long @Nullable [] getCopy(long... aArray) Get a 1:1 copy of the passed array.- Parameters:
aArray- The array to be copied. May benull.- Returns:
nullif the passed array isnull- a non-nullcopy otherwise.
-
getCopy
@ReturnsMutableCopy public static long @Nullable [] getCopy(long @Nullable [] 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
@ReturnsMutableCopy public static long @Nullable [] getCopy(long @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy public static short @Nullable [] getCopy(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
@ReturnsMutableCopy public static short @Nullable [] getCopy(short @Nullable [] 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
@ReturnsMutableCopy public static short @Nullable [] getCopy(short @Nullable [] 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:
-
getCopy
@ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static <ELEMENTTYPE> @Nullable 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:
-
startsWith
public static boolean startsWith(byte @NonNull [] aArray, byte @Nullable [] aSearch) Check if the byte array starts with the given search bytes.- Parameters:
aArray- The array to search in. May not benull.aSearch- The bytes to search for. May benull.- Returns:
trueif the array starts with the search bytes,falseotherwise.
-
startsWith
public static boolean startsWith(byte @NonNull [] aArray, @Nonnegative int nArrayLen, byte @Nullable [] aSearch) Check if the byte array starts with the given search bytes.- Parameters:
aArray- The array to search in. May not benull.nArrayLen- The number of bytes to consider in the array.aSearch- The bytes to search for. May benull.- Returns:
trueif the array starts with the search bytes,falseotherwise.
-
startsWith
public static boolean startsWith(byte @NonNull [] aArray, byte @Nullable [] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) Check if the byte array starts with the given search bytes.- Parameters:
aArray- The array to search in. May not benull.aSearch- The bytes to search for. May benull.nSearchOfs- The offset in the search array.nSearchLen- The number of bytes to search for.- Returns:
trueif the array starts with the search bytes,falseotherwise.
-
startsWith
public static boolean startsWith(byte @NonNull [] aArray, @Nonnegative int nArrayLen, byte @Nullable [] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) Check if the byte array starts with the given search bytes.- Parameters:
aArray- The array to search in. May not benull.nArrayLen- The number of bytes to consider in the array.aSearch- The bytes to search for. May benull.nSearchOfs- The offset in the search array.nSearchLen- The number of bytes to search for.- Returns:
trueif the array starts with the search bytes,falseotherwise.
-
startsWith
public static boolean startsWith(byte @NonNull [] aArray, @Nonnegative int nArrayOfs, @Nonnegative int nArrayLen, byte @Nullable [] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) Check if the byte array starts with the given search bytes.- Parameters:
aArray- The array to search in. May not benull.nArrayOfs- The offset in the array to start comparing from.nArrayLen- The number of bytes to consider in the array.aSearch- The bytes to search for. May benull.nSearchOfs- The offset in the search array.nSearchLen- The number of bytes to search for.- Returns:
trueif the array starts with the search bytes,falseotherwise.
-
startsWith
public static boolean startsWith(char @NonNull [] aArray, char @Nullable [] aSearch) Check if the char array starts with the given search chars.- Parameters:
aArray- The array to search in. May not benull.aSearch- The chars to search for. May benull.- Returns:
trueif the array starts with the search chars,falseotherwise.
-
startsWith
public static boolean startsWith(char @NonNull [] aArray, @Nonnegative int nArrayLen, char @Nullable [] aSearch) Check if the char array starts with the given search chars.- Parameters:
aArray- The array to search in. May not benull.nArrayLen- The number of chars to consider in the array.aSearch- The chars to search for. May benull.- Returns:
trueif the array starts with the search chars,falseotherwise.
-
startsWith
public static boolean startsWith(char @NonNull [] aArray, char @Nullable [] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) Check if the char array starts with the given search chars.- Parameters:
aArray- The array to search in. May not benull.aSearch- The chars to search for. May benull.nSearchOfs- The offset in the search array.nSearchLen- The number of chars to search for.- Returns:
trueif the array starts with the search chars,falseotherwise.
-
startsWith
public static boolean startsWith(char @NonNull [] aArray, @Nonnegative int nArrayLen, char @Nullable [] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) Check if the char array starts with the given search chars.- Parameters:
aArray- The array to search in. May not benull.nArrayLen- The number of chars to consider in the array.aSearch- The chars to search for. May benull.nSearchOfs- The offset in the search array.nSearchLen- The number of chars to search for.- Returns:
trueif the array starts with the search chars,falseotherwise.
-
startsWith
public static boolean startsWith(char @NonNull [] aArray, @Nonnegative int nArrayOfs, @Nonnegative int nArrayLen, char @Nullable [] aSearch, @Nonnegative int nSearchOfs, @Nonnegative int nSearchLen) Check if the char array starts with the given search chars.- Parameters:
aArray- The array to search in. May not benull.nArrayOfs- The offset in the array to start comparing from.nArrayLen- The number of chars to consider in the array.aSearch- The chars to search for. May benull.nSearchOfs- The offset in the search array.nSearchLen- The number of chars to search for.- Returns:
trueif the array starts with the search chars,falseotherwise.
-
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(boolean @Nullable [] 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(byte @Nullable [] 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(char @Nullable [] 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(double @Nullable [] 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(float @Nullable [] 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(int @Nullable [] 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(long @Nullable [] 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(short @Nullable [] 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(boolean @Nullable [] 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(byte @Nullable [] 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(char @Nullable [] 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(double @Nullable [] 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(float @Nullable [] 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(int @Nullable [] 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(long @Nullable [] 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(short @Nullable [] 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(boolean @Nullable [] 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(byte @Nullable [] 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(char @Nullable [] 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(double @Nullable [] 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(float @Nullable [] 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
@UsedInGeneratedCode public static boolean contains(int @Nullable [] 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(long @Nullable [] 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(short @Nullable [] 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(boolean @Nullable [] 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(byte @Nullable [] 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(char @Nullable [] 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(double @Nullable [] 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(float @Nullable [] 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(int @Nullable [] 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(long @Nullable [] 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(short @Nullable [] 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
@SafeVarargs public static <ELEMENTTYPE> @Nullable 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
public static <ELEMENTTYPE> @Nullable 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(boolean @Nullable [] 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(byte @Nullable [] 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(char @Nullable [] 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(double @Nullable [] 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(float @Nullable [] 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(int @Nullable [] 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(long @Nullable [] 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(short @Nullable [] 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
@SafeVarargs public static <ELEMENTTYPE> @Nullable 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
public static <ELEMENTTYPE> @Nullable 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.
-
getConcatenated
@ReturnsMutableCopy public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull 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
@ReturnsMutableCopy public static <ELEMENTTYPE> @NonNull 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
@ReturnsMutableCopy public static boolean @Nullable [] getConcatenated(boolean @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static boolean @NonNull [] getConcatenated(boolean aHead, 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
@ReturnsMutableCopy public static boolean @NonNull [] getConcatenated(boolean @Nullable [] 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
@ReturnsMutableCopy public static byte @Nullable [] getConcatenated(byte @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static byte @NonNull [] getConcatenated(byte aHead, 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
@ReturnsMutableCopy public static byte @NonNull [] getConcatenated(byte @Nullable [] 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
@ReturnsMutableCopy public static char @Nullable [] getConcatenated(char @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static char[] @Nullable [] getConcatenated(char[] @Nullable [] aHeadArray, char[] @Nullable ... 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
@ReturnsMutableCopy public static char @NonNull [] getConcatenated(char aHead, 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
@ReturnsMutableCopy public static char @NonNull [] getConcatenated(char @Nullable [] 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
@ReturnsMutableCopy public static double @Nullable [] getConcatenated(double @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static double @NonNull [] getConcatenated(double aHead, 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
@ReturnsMutableCopy public static double @NonNull [] getConcatenated(double @Nullable [] 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
@ReturnsMutableCopy public static float @Nullable [] getConcatenated(float @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static float @NonNull [] getConcatenated(float aHead, 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
@ReturnsMutableCopy public static float @NonNull [] getConcatenated(float @Nullable [] 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
@ReturnsMutableCopy public static int @Nullable [] getConcatenated(int @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static int @NonNull [] getConcatenated(int aHead, 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
@ReturnsMutableCopy public static int @NonNull [] getConcatenated(int @Nullable [] 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
@ReturnsMutableCopy public static long @Nullable [] getConcatenated(long @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static long @NonNull [] getConcatenated(long aHead, 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
@ReturnsMutableCopy public static long @NonNull [] getConcatenated(long @Nullable [] 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
@ReturnsMutableCopy public static short @Nullable [] getConcatenated(short @Nullable [] aHeadArray, 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
@ReturnsMutableCopy public static short @NonNull [] getConcatenated(short aHead, 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
@ReturnsMutableCopy public static short @NonNull [] getConcatenated(short @Nullable [] 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
@ReturnsMutableCopy public static @NonNull 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
@ReturnsMutableCopy public static @NonNull 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
@ReturnsMutableCopy public static @NonNull 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
@ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static boolean @Nullable [] getAllExcept(boolean @Nullable [] aArray, 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
@ReturnsMutableCopy public static byte @Nullable [] getAllExcept(byte @Nullable [] aArray, 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
@ReturnsMutableCopy public static char @Nullable [] getAllExcept(char @Nullable [] aArray, 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
@ReturnsMutableCopy public static double @Nullable [] getAllExcept(double @Nullable [] aArray, 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
@ReturnsMutableCopy public static float @Nullable [] getAllExcept(float @Nullable [] aArray, 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
@ReturnsMutableCopy public static int @Nullable [] getAllExcept(int @Nullable [] aArray, 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
@ReturnsMutableCopy public static long @Nullable [] getAllExcept(long @Nullable [] aArray, 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
@ReturnsMutableCopy public static short @Nullable [] getAllExcept(short @Nullable [] aArray, 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
@ReturnsMutableCopy public static boolean @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static boolean @Nullable [] getAllExceptFirst(boolean @Nullable [] 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
@ReturnsMutableCopy public static byte @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static byte @Nullable [] getAllExceptFirst(byte @Nullable [] 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
@ReturnsMutableCopy public static char @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static char @Nullable [] getAllExceptFirst(char @Nullable [] 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
@ReturnsMutableCopy public static double @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static double @Nullable [] getAllExceptFirst(double @Nullable [] 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
@ReturnsMutableCopy public static float @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static float @Nullable [] getAllExceptFirst(float @Nullable [] 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
@ReturnsMutableCopy public static int @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static int @Nullable [] getAllExceptFirst(int @Nullable [] 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
@ReturnsMutableCopy public static long @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static long @Nullable [] getAllExceptFirst(long @Nullable [] 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
@ReturnsMutableCopy public static short @Nullable [] getAllExceptFirst(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
@ReturnsMutableCopy public static short @Nullable [] getAllExceptFirst(short @Nullable [] 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
@ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static <ELEMENTTYPE> @Nullable 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
@ReturnsMutableCopy public static boolean @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static boolean @Nullable [] getAllExceptLast(boolean @Nullable [] 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
@ReturnsMutableCopy public static byte @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static byte @Nullable [] getAllExceptLast(byte @Nullable [] 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
@ReturnsMutableCopy public static char @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static char @Nullable [] getAllExceptLast(char @Nullable [] 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
@ReturnsMutableCopy public static double @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static double @Nullable [] getAllExceptLast(double @Nullable [] 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
@ReturnsMutableCopy public static float @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static float @Nullable [] getAllExceptLast(float @Nullable [] 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
@ReturnsMutableCopy public static int @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static int @Nullable [] getAllExceptLast(int @Nullable [] 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
@ReturnsMutableCopy public static long @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static long @Nullable [] getAllExceptLast(long @Nullable [] 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
@ReturnsMutableCopy public static short @Nullable [] getAllExceptLast(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
@ReturnsMutableCopy public static short @Nullable [] getAllExceptLast(short @Nullable [] 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.
-
getAsObjectArray
@ReturnsMutableCopy public static @Nullable 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
public static <ELEMENTTYPE> @Nullable ELEMENTTYPE getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex) Get an element from the passed array without throwing anArrayIndexOutOfBoundsException.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aItems- The array to get the element from. May benull.nIndex- The index to retrieve.- Returns:
nullif the array isnullor if the index is out of bounds.
-
getSafeElement
public static <ELEMENTTYPE> @Nullable ELEMENTTYPE getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex, @Nullable ELEMENTTYPE aDefault) Get an element from the passed array without throwing anArrayIndexOutOfBoundsException.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aItems- The array to get the element from. May benull.nIndex- The index to retrieve.aDefault- The default value to return if the index is out of bounds. May benull.- Returns:
- The element at the specified index or the default value if the array is
nullor the index is out of bounds.
-
isArray
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.
-
isArrayEquals
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
public static <ELEMENTTYPE> @Nullable ELEMENTTYPE findFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Find the first element in the array matching the provided filter.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to search. May benull.aFilter- The filter to be applied. May benullin which case the first element is returned.- Returns:
nullif no matching element was found or if the array isnullor empty.
-
findFirst
public static <ELEMENTTYPE> @Nullable ELEMENTTYPE findFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nullable ELEMENTTYPE aDefault) Find the first element in the array matching the provided filter.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to search. May benull.aFilter- The filter to be applied. May benullin which case the first element is returned.aDefault- The default value to return if no matching element was found. May benull.- Returns:
- The default value if no matching element was found or if the array is
nullor empty.
-
findFirstMapped
public static <ELEMENTTYPE,RETTYPE> @Nullable RETTYPE findFirstMapped(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @NonNull Function<? super ELEMENTTYPE, RETTYPE> aMapper) Find the first element in the array matching the provided filter and apply a mapping function to it.- Type Parameters:
ELEMENTTYPE- Array element typeRETTYPE- Return type after mapping- Parameters:
aArray- The array to search. May benull.aFilter- The filter to be applied. May benullin which case the first element is used.aMapper- The mapping function to apply to the matching element. May not benull.- Returns:
nullif no matching element was found or if the array isnullor empty.
-
findFirstMapped
public static <ELEMENTTYPE,RETTYPE> @Nullable RETTYPE findFirstMapped(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @NonNull Function<? super ELEMENTTYPE, RETTYPE> aMapper, @Nullable RETTYPE aDefault) Find the first element in the array matching the provided filter and apply a mapping function to it.- Type Parameters:
ELEMENTTYPE- Array element typeRETTYPE- Return type after mapping- Parameters:
aArray- The array to search. May benull.aFilter- The filter to be applied. May benullin which case the first element is used.aMapper- The mapping function to apply to the matching element. May not benull.aDefault- The default value to return if no matching element was found. May benull.- Returns:
- The default value if no matching element was found or if the array is
nullor empty.
-
getCount
@Nonnegative public static <ELEMENTTYPE> int getCount(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Count the number of elements in the array matching the provided filter.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to count in. May benull.aFilter- The filter to be applied. May benullin which case the array length is returned.- Returns:
- The number of matching elements. Always ≥ 0.
-
containsAny
public static <ELEMENTTYPE> boolean containsAny(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Check if the passed array contains at least one element matching the provided filter.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to check. May benull.aFilter- The filter to be applied. May benullin which case this method checks if the array is non-empty.- Returns:
trueif at least one element matches the filter,falseotherwise.
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @NonNull Consumer<? super ELEMENTTYPE> aConsumer) Invoke the provided consumer for each element of the passed array.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to iterate. May benull.aConsumer- The consumer to invoke for each element. May not benull.
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @NonNull ObjIntConsumer<? super ELEMENTTYPE> aConsumer) Invoke the provided consumer for each element of the passed array, providing both the element and its index.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to iterate. May benull.aConsumer- The consumer to invoke for each element with the element and its 0-based index. May not benull.
-
forEach
public static <ELEMENTTYPE> void forEach(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @NonNull Consumer<? super ELEMENTTYPE> aConsumer) Invoke the provided consumer for each element of the passed array that matches the filter.- Type Parameters:
ELEMENTTYPE- Array element type- Parameters:
aArray- The array to iterate. May benull.aFilter- The filter to be applied. May benullin which case all elements are consumed.aConsumer- The consumer to invoke for each matching element. May not benull.
-