Class ArrayHelper

java.lang.Object
com.helger.base.array.ArrayHelper

@Immutable public final class ArrayHelper extends Object
Provides additional helper methods for array handling.
Author:
Philip Helger
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    contains(boolean @Nullable [] aValues, boolean aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(byte @Nullable [] aValues, byte aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(char @Nullable [] aValues, char aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(double @Nullable [] aValues, double aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(float @Nullable [] aValues, float aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(int @Nullable [] aValues, int aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(long @Nullable [] aValues, long aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static boolean
    contains(short @Nullable [] aValues, short aSearchValue)
    Check if the passed search value is contained in the passed value array.
    static <ELEMENTTYPE>
    boolean
    contains(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue)
    Check if the passed search value is contained in the passed value array.
    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.
    static <T> boolean
    containsAnyNullElement(@Nullable T[] aArray)
    Check if the passed array contains at least one null element.
    static <T> boolean
    containsOnlyNullElements(@Nullable T[] aArray)
    Check if the passed array contains only null element.
    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 ELEMENTTYPE
    findFirst(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter)
    Find the first element in the array matching the provided filter.
    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.
    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.
    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.
    static <ELEMENTTYPE>
    void
    forEach(@Nullable ELEMENTTYPE[] aArray, @NonNull Consumer<? super ELEMENTTYPE> aConsumer)
    Invoke the provided consumer for each element of the passed array.
    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.
    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.
    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>
    int
    getCount(@Nullable ELEMENTTYPE[] aArray, @Nullable Predicate<? super ELEMENTTYPE> aFilter)
    Count the number of elements in the array matching the provided filter.
    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.
    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.
    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.
    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.
    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.
    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.
    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.
    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.
    static <ELEMENTTYPE>
    @Nullable ELEMENTTYPE
    getFirst(@Nullable ELEMENTTYPE... aArray)
    Get the first element of the array or null if the passed array is empty.
    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.
    static int
    getFirstIndex(boolean @Nullable [] aValues, boolean aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(byte @Nullable [] aValues, byte aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(char @Nullable [] aValues, char aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(double @Nullable [] aValues, double aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(float @Nullable [] aValues, float aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(int @Nullable [] aValues, int aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(long @Nullable [] aValues, long aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getFirstIndex(short @Nullable [] aValues, short aSearchValue)
    Get the index of the passed search value in the passed value array.
    static <ELEMENTTYPE>
    int
    getFirstIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue)
    Get the index of the passed search value in the passed value array.
    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.
    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.
    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.
    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.
    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.
    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.
    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.
    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.
    static <ELEMENTTYPE>
    @Nullable ELEMENTTYPE
    getLast(@Nullable ELEMENTTYPE... aArray)
    Get the last element of the array or null if the passed array is empty.
    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.
    static int
    getLastIndex(boolean @Nullable [] aValues, boolean aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(byte @Nullable [] aValues, byte aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(char @Nullable [] aValues, char aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(double @Nullable [] aValues, double aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(float @Nullable [] aValues, float aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(int @Nullable [] aValues, int aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(long @Nullable [] aValues, long aSearchValue)
    Get the index of the passed search value in the passed value array.
    static int
    getLastIndex(short @Nullable [] aValues, short aSearchValue)
    Get the index of the passed search value in the passed value array.
    static <ELEMENTTYPE>
    int
    getLastIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue)
    Get the index of the passed search value in the passed value array.
    static <ELEMENTTYPE>
    @Nullable ELEMENTTYPE
    getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex)
    Get an element from the passed array without throwing an ArrayIndexOutOfBoundsException.
    static <ELEMENTTYPE>
    @Nullable ELEMENTTYPE
    getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex, @Nullable ELEMENTTYPE aDefault)
    Get an element from the passed array without throwing an ArrayIndexOutOfBoundsException.
    static int
    getSize(boolean... aArray)
     
    static int
    getSize(byte... aArray)
     
    static int
    getSize(char... aArray)
     
    static int
    getSize(double... aArray)
     
    static int
    getSize(float... aArray)
     
    static int
    getSize(int... aArray)
     
    static int
    getSize(long... aArray)
     
    static int
    getSize(short... aArray)
     
    static <ELEMENTTYPE>
    int
    getSize(@Nullable ELEMENTTYPE... aArray)
     
    static boolean
    isArray(@Nullable Object aObject)
    Check if the passed object is an array or not.
    static boolean
    isArrayEquals(@Nullable Object aHeadArray, @Nullable Object aTailArray)
    Recursive equal comparison for arrays.
    static boolean
    isEmpty(boolean... aArray)
     
    static boolean
    isEmpty(byte... aArray)
     
    static boolean
    isEmpty(char... aArray)
     
    static boolean
    isEmpty(double... aArray)
     
    static boolean
    isEmpty(float... aArray)
     
    static boolean
    isEmpty(int... aArray)
     
    static boolean
    isEmpty(long... aArray)
     
    static boolean
    isEmpty(short... aArray)
     
    static <ELEMENTTYPE>
    boolean
    isEmpty(@Nullable ELEMENTTYPE... aArray)
     
    static boolean
    isNotEmpty(boolean... aArray)
     
    static boolean
    isNotEmpty(byte... aArray)
     
    static boolean
    isNotEmpty(char... aArray)
     
    static boolean
    isNotEmpty(double... aArray)
     
    static boolean
    isNotEmpty(float... aArray)
     
    static boolean
    isNotEmpty(int... aArray)
     
    static boolean
    isNotEmpty(long... aArray)
     
    static boolean
    isNotEmpty(short... aArray)
     
    static <ELEMENTTYPE>
    boolean
    isNotEmpty(@Nullable ELEMENTTYPE... aArray)
     
    static boolean
    startsWith(byte @NonNull [] aArray, byte @Nullable [] aSearch)
    Check if the byte array starts with the given search bytes.
    static boolean
    startsWith(byte @NonNull [] aArray, byte @Nullable [] aSearch, int nSearchOfs, int nSearchLen)
    Check if the byte array starts with the given search bytes.
    static boolean
    startsWith(byte @NonNull [] aArray, int nArrayLen, byte @Nullable [] aSearch)
    Check if the byte array starts with the given search bytes.
    static boolean
    startsWith(byte @NonNull [] aArray, int nArrayLen, byte @Nullable [] aSearch, int nSearchOfs, int nSearchLen)
    Check if the byte array starts with the given search bytes.
    static boolean
    startsWith(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 boolean
    startsWith(char @NonNull [] aArray, char @Nullable [] aSearch)
    Check if the char array starts with the given search chars.
    static boolean
    startsWith(char @NonNull [] aArray, char @Nullable [] aSearch, int nSearchOfs, int nSearchLen)
    Check if the char array starts with the given search chars.
    static boolean
    startsWith(char @NonNull [] aArray, int nArrayLen, char @Nullable [] aSearch)
    Check if the char array starts with the given search chars.
    static boolean
    startsWith(char @NonNull [] aArray, int nArrayLen, char @Nullable [] aSearch, int nSearchOfs, int nSearchLen)
    Check if the char array starts with the given search chars.
    static boolean
    startsWith(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 be null.
      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 be null.
      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 be null.
      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 be null.
      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 be null.
      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 be null.
      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 be null.
      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 be null.
      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 be null.
      Returns:
      0 if the passed array is null - it's length otherwise.
    • getSize

      @Nonnegative @SafeVarargs public static <ELEMENTTYPE> int getSize(@Nullable ELEMENTTYPE... aArray)
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aArray - The array who's size is to be queried. May be null.
      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 be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(byte... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(char... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(double... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(float... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(int... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(long... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      public static boolean isEmpty(short... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isEmpty

      @SafeVarargs public static <ELEMENTTYPE> boolean isEmpty(@Nullable ELEMENTTYPE... aArray)
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      true if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(boolean... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(byte... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(char... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(double... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(float... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(int... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(long... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      public static boolean isNotEmpty(short... aArray)
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or empty.
    • isNotEmpty

      @SafeVarargs public static <ELEMENTTYPE> boolean isNotEmpty(@Nullable ELEMENTTYPE... aArray)
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aArray - The array to be queried if it is empty. May be null.
      Returns:
      false if the passed array is null or 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null.
      Returns:
      The passed array. null if the passed array was null.
    • 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 be null and 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 be null.
      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 be null .
      aClass - The class of the elements inside the collection. May not be null.
      Returns:
      null if the passed collection is empty, a non- null array 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 be null.
      aClass - The class of the element. May not be null. Must be present because in case the passed element is null there 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 be null.
      aClass - The value class. May not be null. Must be present in case the passed value is null.
      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 type
      DSTTYPE - Destination element type
      Parameters:
      aCollection - The source collection. May not be null.
      aMapper - The mapping function. May not be null.
      aDstClass - The destination array element class. May not be null.
      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 type
      DSTTYPE - Destination element type
      Parameters:
      aArray - The source array. May be null.
      aMapper - The mapping function. May not be null.
      aDstClass - The destination array element class. May not be null.
      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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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 be null.
      Returns:
      null if the passed array is null - a non-null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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:
      null if the passed array is null - a non- null copy 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 be null.
      aSearch - The bytes to search for. May be null.
      Returns:
      true if the array starts with the search bytes, false otherwise.
    • 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 be null.
      nArrayLen - The number of bytes to consider in the array.
      aSearch - The bytes to search for. May be null.
      Returns:
      true if the array starts with the search bytes, false otherwise.
    • 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 be null.
      aSearch - The bytes to search for. May be null.
      nSearchOfs - The offset in the search array.
      nSearchLen - The number of bytes to search for.
      Returns:
      true if the array starts with the search bytes, false otherwise.
    • 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 be null.
      nArrayLen - The number of bytes to consider in the array.
      aSearch - The bytes to search for. May be null.
      nSearchOfs - The offset in the search array.
      nSearchLen - The number of bytes to search for.
      Returns:
      true if the array starts with the search bytes, false otherwise.
    • 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 be null.
      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 be null.
      nSearchOfs - The offset in the search array.
      nSearchLen - The number of bytes to search for.
      Returns:
      true if the array starts with the search bytes, false otherwise.
    • 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 be null.
      aSearch - The chars to search for. May be null.
      Returns:
      true if the array starts with the search chars, false otherwise.
    • 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 be null.
      nArrayLen - The number of chars to consider in the array.
      aSearch - The chars to search for. May be null.
      Returns:
      true if the array starts with the search chars, false otherwise.
    • 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 be null.
      aSearch - The chars to search for. May be null.
      nSearchOfs - The offset in the search array.
      nSearchLen - The number of chars to search for.
      Returns:
      true if the array starts with the search chars, false otherwise.
    • 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 be null.
      nArrayLen - The number of chars to consider in the array.
      aSearch - The chars to search for. May be null.
      nSearchOfs - The offset in the search array.
      nSearchLen - The number of chars to search for.
      Returns:
      true if the array starts with the search chars, false otherwise.
    • 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 be null.
      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 be null.
      nSearchOfs - The offset in the search array.
      nSearchLen - The number of chars to search for.
      Returns:
      true if the array starts with the search chars, false otherwise.
    • 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if the searched value is not contained, a value ≥ 0 otherwise.
    • getLastIndex

      public static <ELEMENTTYPE> int getLastIndex(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue)
      Get the index of the passed search value in the passed value array.
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aValues - The value array to be searched. May be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      -1 if the searched value is not contained, a value ≥ 0 otherwise.
    • contains

      public static <ELEMENTTYPE> boolean contains(@Nullable ELEMENTTYPE[] aValues, @Nullable ELEMENTTYPE aSearchValue)
      Check if the passed search value is contained in the passed value array.
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aValues - The value array to be searched. May be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null.
      aSearchValue - The value to be searched. May be null.
      Returns:
      true if 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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getFirst

      @SafeVarargs public static <ELEMENTTYPE> @Nullable ELEMENTTYPE getFirst(@Nullable ELEMENTTYPE... aArray)
      Get the first element of the array or null 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 be null or empty.
      Returns:
      null if the passed array is null or empty - the first element otherwise (may also be null).
    • 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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the first element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • getLast

      @SafeVarargs public static <ELEMENTTYPE> @Nullable ELEMENTTYPE getLast(@Nullable ELEMENTTYPE... aArray)
      Get the last element of the array or null 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 be null or empty.
      Returns:
      null if the passed array is null or empty - the last element otherwise (may also be null).
    • 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 be null or empty.
      aDefaultValue - The default value to be returned if the array is empty
      Returns:
      the last element if the passed array is not empty, the default value if the passed array is empty.
    • 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 is null it will be inserted as such into the array!
      aTailArray - The tail array. May be null.
      aClass - The element class. Must be present, because in case both elements are null there would be no way to create a new array. May not be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      aTail - The last element of the result array. If this element is null it will be inserted as such into the array!
      aClass - The element class. Must be present, because in case both elements are null there would be no way to create a new array. May not be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      aTailArray - The second array. May be null.
      Returns:
      null if both array parameters are null - a non-null array 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 be null.
      Returns:
      A non-null array 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 be null.
      aTail - The last element of the result array.
      Returns:
      A non-null array 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      aElementsToRemove - The elements to skip.
      Returns:
      null if the passed array is null. The original array, if no elements need to be skipped. A non- null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 be null.
      Returns:
      null if the passed array is null or has less than one element. A non-null copy 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 be null.
      nElementsToSkip - The number of elements to skip. Must be >= 0!
      Returns:
      null if the passed array is null or has ≤ elements than elements to be skipped. A non-null copy 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 is null or empty, an empty array is returned.
      Parameters:
      aCollection - The collection to be converted. May be null.
      Returns:
      Never null.
    • getSafeElement

      public static <ELEMENTTYPE> @Nullable ELEMENTTYPE getSafeElement(@Nullable ELEMENTTYPE[] aItems, int nIndex)
      Get an element from the passed array without throwing an ArrayIndexOutOfBoundsException.
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aItems - The array to get the element from. May be null.
      nIndex - The index to retrieve.
      Returns:
      null if the array is null or 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 an ArrayIndexOutOfBoundsException.
      Type Parameters:
      ELEMENTTYPE - Array element type
      Parameters:
      aItems - The array to get the element from. May be null.
      nIndex - The index to retrieve.
      aDefault - The default value to return if the index is out of bounds. May be null.
      Returns:
      The element at the specified index or the default value if the array is null or the index is out of bounds.
    • isArray

      public static boolean isArray(@Nullable Object aObject)
      Check if the passed object is an array or not.
      Parameters:
      aObject - The object to be checked. May be null.
      Returns:
      true if the passed object is not null and represents an array.
    • isArrayEquals

      public static boolean isArrayEquals(@Nullable Object aHeadArray, @Nullable Object aTailArray)
      Recursive equal comparison for arrays.
      Parameters:
      aHeadArray - First array. May be null.
      aTailArray - Second array. May be null.
      Returns:
      true only 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 one null element.
      Type Parameters:
      T - element type
      Parameters:
      aArray - The array to check. May be null.
      Returns:
      true only if the passed array is neither null nor empty and if at least one null element is contained.
    • containsOnlyNullElements

      public static <T> boolean containsOnlyNullElements(@Nullable T[] aArray)
      Check if the passed array contains only null element.
      Type Parameters:
      T - element type
      Parameters:
      aArray - The array to check. May be null.
      Returns:
      true only if the passed array is neither null nor empty and if at least one null element 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 be null.
      aFilter - The filter to be applied. May be null in which case the first element is returned.
      Returns:
      null if no matching element was found or if the array is null or 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 be null.
      aFilter - The filter to be applied. May be null in which case the first element is returned.
      aDefault - The default value to return if no matching element was found. May be null.
      Returns:
      The default value if no matching element was found or if the array is null or 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 type
      RETTYPE - Return type after mapping
      Parameters:
      aArray - The array to search. May be null.
      aFilter - The filter to be applied. May be null in which case the first element is used.
      aMapper - The mapping function to apply to the matching element. May not be null.
      Returns:
      null if no matching element was found or if the array is null or 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 type
      RETTYPE - Return type after mapping
      Parameters:
      aArray - The array to search. May be null.
      aFilter - The filter to be applied. May be null in which case the first element is used.
      aMapper - The mapping function to apply to the matching element. May not be null.
      aDefault - The default value to return if no matching element was found. May be null.
      Returns:
      The default value if no matching element was found or if the array is null or 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 be null.
      aFilter - The filter to be applied. May be null in 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 be null.
      aFilter - The filter to be applied. May be null in which case this method checks if the array is non-empty.
      Returns:
      true if at least one element matches the filter, false otherwise.
    • 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 be null.
      aConsumer - The consumer to invoke for each element. May not be null.
    • 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 be null.
      aConsumer - The consumer to invoke for each element with the element and its 0-based index. May not be null.
    • 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 be null.
      aFilter - The filter to be applied. May be null in which case all elements are consumed.
      aConsumer - The consumer to invoke for each matching element. May not be null.