Class ArrayHelper


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean contains​(boolean[] aValues, boolean aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(byte[] aValues, byte aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(char[] aValues, char aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(double[] aValues, double aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(float[] aValues, float aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(int[] aValues, int aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(long[] aValues, long aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static boolean contains​(short[] aValues, short aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static <ELEMENTTYPE>
      boolean
      contains​(ELEMENTTYPE[] aValues, ELEMENTTYPE aSearchValue)
      Check if the passed search value is contained in the passed value array.
      static <ELEMENTTYPE>
      boolean
      containsAny​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter)  
      static <T> boolean containsAnyNullElement​(T[] aArray)
      Check if the passed array contains at least one null element.
      static <T> boolean containsOnlyNullElements​(T[] aArray)
      Check if the passed array contains only null element.
      static <ELEMENTTYPE>
      ELEMENTTYPE
      findFirst​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter)  
      static <ELEMENTTYPE>
      ELEMENTTYPE
      findFirst​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, ELEMENTTYPE aDefault)  
      static <ELEMENTTYPE,​RETTYPE>
      RETTYPE
      findFirstMapped​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE,​RETTYPE> aMapper)  
      static <ELEMENTTYPE,​RETTYPE>
      RETTYPE
      findFirstMapped​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE,​RETTYPE> aMapper, RETTYPE aDefault)  
      static <ELEMENTTYPE>
      void
      forEach​(ELEMENTTYPE[] aArray, Consumer<? super ELEMENTTYPE> aConsumer)  
      static <ELEMENTTYPE>
      void
      forEach​(ELEMENTTYPE[] aArray, ObjIntConsumer<? super ELEMENTTYPE> aConsumer)  
      static <ELEMENTTYPE>
      void
      forEach​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter, Consumer<? super ELEMENTTYPE> aConsumer)  
      static boolean[] getAllExcept​(boolean[] aArray, boolean... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static byte[] getAllExcept​(byte[] aArray, byte... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static char[] getAllExcept​(char[] aArray, char... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static double[] getAllExcept​(double[] aArray, double... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static float[] getAllExcept​(float[] aArray, float... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static int[] getAllExcept​(int[] aArray, int... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static long[] getAllExcept​(long[] aArray, long... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static short[] getAllExcept​(short[] aArray, short... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getAllExcept​(ELEMENTTYPE[] aArray, ELEMENTTYPE... aElementsToRemove)
      Get an array that contains all elements, except for the passed elements.
      static boolean[] getAllExceptFirst​(boolean... aArray)
      Get an array that contains all elements, except for the first element.
      static boolean[] getAllExceptFirst​(boolean[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static byte[] getAllExceptFirst​(byte... aArray)
      Get an array that contains all elements, except for the first element.
      static byte[] getAllExceptFirst​(byte[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static char[] getAllExceptFirst​(char... aArray)
      Get an array that contains all elements, except for the first element.
      static char[] getAllExceptFirst​(char[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static double[] getAllExceptFirst​(double... aArray)
      Get an array that contains all elements, except for the first element.
      static double[] getAllExceptFirst​(double[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static float[] getAllExceptFirst​(float... aArray)
      Get an array that contains all elements, except for the first element.
      static float[] getAllExceptFirst​(float[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static int[] getAllExceptFirst​(int... aArray)
      Get an array that contains all elements, except for the first element.
      static int[] getAllExceptFirst​(int[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static long[] getAllExceptFirst​(long... aArray)
      Get an array that contains all elements, except for the first element.
      static long[] getAllExceptFirst​(long[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static short[] getAllExceptFirst​(short... aArray)
      Get an array that contains all elements, except for the first element.
      static short[] getAllExceptFirst​(short[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getAllExceptFirst​(ELEMENTTYPE... aArray)
      Get an array that contains all elements, except for the first element.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getAllExceptFirst​(ELEMENTTYPE[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the first n elements.
      static boolean[] getAllExceptLast​(boolean... aArray)
      Get an array that contains all elements, except for the last element.
      static boolean[] getAllExceptLast​(boolean[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static byte[] getAllExceptLast​(byte... aArray)
      Get an array that contains all elements, except for the last element.
      static byte[] getAllExceptLast​(byte[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static char[] getAllExceptLast​(char... aArray)
      Get an array that contains all elements, except for the last element.
      static char[] getAllExceptLast​(char[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static double[] getAllExceptLast​(double... aArray)
      Get an array that contains all elements, except for the last element.
      static double[] getAllExceptLast​(double[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static float[] getAllExceptLast​(float... aArray)
      Get an array that contains all elements, except for the last element.
      static float[] getAllExceptLast​(float[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static int[] getAllExceptLast​(int... aArray)
      Get an array that contains all elements, except for the last element.
      static int[] getAllExceptLast​(int[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static long[] getAllExceptLast​(long... aArray)
      Get an array that contains all elements, except for the last element.
      static long[] getAllExceptLast​(long[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static short[] getAllExceptLast​(short... aArray)
      Get an array that contains all elements, except for the last element.
      static short[] getAllExceptLast​(short[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getAllExceptLast​(ELEMENTTYPE... aArray)
      Get an array that contains all elements, except for the last element.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getAllExceptLast​(ELEMENTTYPE[] aArray, int nElementsToSkip)
      Get an array that contains all elements, except for the last n elements.
      static Object[] getAsObjectArray​(Collection<?> aCollection)
      Get the passed collection as an array of Object.
      static <ELEMENTTYPE>
      Class<? extends ELEMENTTYPE>
      getComponentType​(ELEMENTTYPE[] aArray)
      Get the component type of the array (the type of which the array is made up)
      static boolean[] getConcatenated​(boolean[] aHeadArray, boolean aTail)
      Get a new array that combines the passed array and the tail element.
      static boolean[] getConcatenated​(boolean[] aHeadArray, boolean... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static boolean[] getConcatenated​(boolean aHead, boolean... aTailArray)
      Get a new array that combines the passed head element and the array.
      static byte[] getConcatenated​(byte[] aHeadArray, byte aTail)
      Get a new array that combines the passed array and the tail element.
      static byte[] getConcatenated​(byte[] aHeadArray, byte... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static byte[] getConcatenated​(byte aHead, byte... aTailArray)
      Get a new array that combines the passed head element and the array.
      static char[][] getConcatenated​(char[][] aHeadArray, char[]... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static char[] getConcatenated​(char[] aHeadArray, char aTail)
      Get a new array that combines the passed array and the tail element.
      static char[] getConcatenated​(char[] aHeadArray, char... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static char[] getConcatenated​(char aHead, char... aTailArray)
      Get a new array that combines the passed head element and the array.
      static double[] getConcatenated​(double[] aHeadArray, double aTail)
      Get a new array that combines the passed array and the tail element.
      static double[] getConcatenated​(double[] aHeadArray, double... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static double[] getConcatenated​(double aHead, double... aTailArray)
      Get a new array that combines the passed head element and the array.
      static float[] getConcatenated​(float[] aHeadArray, float aTail)
      Get a new array that combines the passed array and the tail element.
      static float[] getConcatenated​(float[] aHeadArray, float... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static float[] getConcatenated​(float aHead, float... aTailArray)
      Get a new array that combines the passed head element and the array.
      static int[] getConcatenated​(int[] aHeadArray, int aTail)
      Get a new array that combines the passed array and the tail element.
      static int[] getConcatenated​(int[] aHeadArray, int... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static int[] getConcatenated​(int aHead, int... aTailArray)
      Get a new array that combines the passed head element and the array.
      static long[] getConcatenated​(long[] aHeadArray, long aTail)
      Get a new array that combines the passed array and the tail element.
      static long[] getConcatenated​(long[] aHeadArray, long... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static long[] getConcatenated​(long aHead, long... aTailArray)
      Get a new array that combines the passed head element and the array.
      static short[] getConcatenated​(short[] aHeadArray, short aTail)
      Get a new array that combines the passed array and the tail element.
      static short[] getConcatenated​(short[] aHeadArray, short... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static short[] getConcatenated​(short aHead, short... aTailArray)
      Get a new array that combines the passed head element and the array.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getConcatenated​(ELEMENTTYPE[] aHeadArray, ELEMENTTYPE[] aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getConcatenated​(ELEMENTTYPE[] aHeadArray, ELEMENTTYPE aTail, Class<ELEMENTTYPE> aClass)
      Get a new array that combines the passed array and the tail element.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getConcatenated​(ELEMENTTYPE aHead, ELEMENTTYPE[] aTailArray, Class<ELEMENTTYPE> aClass)
      Get a new array that combines the passed head and the array.
      static String[] getConcatenated​(String[] aHeadArray, String aTail)
      Get a new array that combines the passed array and the tail element.
      static String[] getConcatenated​(String[] aHeadArray, String... aTailArray)
      Get a new array that combines the passed two arrays, maintaining the order.
      static String[] getConcatenated​(String aHead, String... aTailArray)
      Get a new array that combines the passed head element and the array.
      static boolean[] getCopy​(boolean... aArray)
      Get a 1:1 copy of the passed array.
      static boolean[] getCopy​(boolean[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static boolean[] getCopy​(boolean[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static byte[] getCopy​(byte... aArray)
      Get a 1:1 copy of the passed array.
      static byte[] getCopy​(byte[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static byte[] getCopy​(byte[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static char[] getCopy​(char... aArray)
      Get a 1:1 copy of the passed array.
      static char[] getCopy​(char[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static char[] getCopy​(char[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static double[] getCopy​(double... aArray)
      Get a 1:1 copy of the passed array.
      static double[] getCopy​(double[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static double[] getCopy​(double[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static float[] getCopy​(float... aArray)
      Get a 1:1 copy of the passed array.
      static float[] getCopy​(float[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static float[] getCopy​(float[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static int[] getCopy​(int... aArray)
      Get a 1:1 copy of the passed array.
      static int[] getCopy​(int[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static int[] getCopy​(int[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array.
      static long[] getCopy​(long... aArray)  
      static long[] getCopy​(long[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static long[] getCopy​(long[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static short[] getCopy​(short... aArray)
      Get a 1:1 copy of the passed array.
      static short[] getCopy​(short[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static short[] getCopy​(short[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getCopy​(ELEMENTTYPE... aArray)
      Get a 1:1 copy of the passed array.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getCopy​(ELEMENTTYPE[] aArray, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      getCopy​(ELEMENTTYPE[] aArray, int nStartIndex, int nLength)
      Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index.
      static <ELEMENTTYPE>
      int
      getCount​(ELEMENTTYPE[] aArray, Predicate<? super ELEMENTTYPE> aFilter)  
      static boolean getFirst​(boolean[] aArray, boolean aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static byte getFirst​(byte[] aArray, byte aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static char getFirst​(char[] aArray, char aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static double getFirst​(double[] aArray, double aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static float getFirst​(float[] aArray, float aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static int getFirst​(int[] aArray, int aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static long getFirst​(long[] aArray, long aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static short getFirst​(short[] aArray, short aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static <ELEMENTTYPE>
      ELEMENTTYPE
      getFirst​(ELEMENTTYPE... aArray)
      Get the first element of the array or null if the passed array is empty.
      static <ELEMENTTYPE>
      ELEMENTTYPE
      getFirst​(ELEMENTTYPE[] aArray, ELEMENTTYPE aDefaultValue)
      Get the first element of the array or the passed default if the passed array is empty.
      static int getFirstIndex​(boolean[] aValues, boolean aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(byte[] aValues, byte aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(char[] aValues, char aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(double[] aValues, double aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(float[] aValues, float aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(int[] aValues, int aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(long[] aValues, long aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getFirstIndex​(short[] aValues, short aSearchValue)
      Get the index of the passed search value in the passed value array.
      static <ELEMENTTYPE>
      int
      getFirstIndex​(ELEMENTTYPE[] aValues, ELEMENTTYPE aSearchValue)
      Get the index of the passed search value in the passed value array.
      static boolean getLast​(boolean[] aArray, boolean aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static byte getLast​(byte[] aArray, byte aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static char getLast​(char[] aArray, char aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static double getLast​(double[] aArray, double aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static float getLast​(float[] aArray, float aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static int getLast​(int[] aArray, int aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static long getLast​(long[] aArray, long aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static short getLast​(short[] aArray, short aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static <ELEMENTTYPE>
      ELEMENTTYPE
      getLast​(ELEMENTTYPE... aArray)
      Get the last element of the array or null if the passed array is empty.
      static <ELEMENTTYPE>
      ELEMENTTYPE
      getLast​(ELEMENTTYPE[] aArray, ELEMENTTYPE aDefaultValue)
      Get the last element of the array or the passed default if the passed array is empty.
      static int getLastIndex​(boolean[] aValues, boolean aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(byte[] aValues, byte aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(char[] aValues, char aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(double[] aValues, double aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(float[] aValues, float aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(int[] aValues, int aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(long[] aValues, long aSearchValue)
      Get the index of the passed search value in the passed value array.
      static int getLastIndex​(short[] aValues, short aSearchValue)
      Get the index of the passed search value in the passed value array.
      static <ELEMENTTYPE>
      int
      getLastIndex​(ELEMENTTYPE[] aValues, ELEMENTTYPE aSearchValue)
      Get the index of the passed search value in the passed value array.
      static <ELEMENTTYPE>
      ELEMENTTYPE
      getSafeElement​(ELEMENTTYPE[] aItems, int nIndex)  
      static <ELEMENTTYPE>
      ELEMENTTYPE
      getSafeElement​(ELEMENTTYPE[] aItems, int nIndex, ELEMENTTYPE aDefault)  
      static int getSize​(boolean... aArray)  
      static int getSize​(byte... aArray)  
      static int getSize​(char... aArray)  
      static int getSize​(double... aArray)  
      static int getSize​(float... aArray)  
      static int getSize​(int... aArray)  
      static int getSize​(long... aArray)  
      static int getSize​(short... aArray)  
      static <ELEMENTTYPE>
      int
      getSize​(ELEMENTTYPE... aArray)  
      static boolean isArray​(Object aObject)
      Check if the passed object is an array or not.
      static boolean isArrayEquals​(Object aHeadArray, Object aTailArray)
      Recursive equal comparison for arrays.
      static boolean isEmpty​(boolean... aArray)  
      static boolean isEmpty​(byte... aArray)  
      static boolean isEmpty​(char... aArray)  
      static boolean isEmpty​(double... aArray)  
      static boolean isEmpty​(float... aArray)  
      static boolean isEmpty​(int... aArray)  
      static boolean isEmpty​(long... aArray)  
      static boolean isEmpty​(short... aArray)  
      static <ELEMENTTYPE>
      boolean
      isEmpty​(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​(ELEMENTTYPE... aArray)  
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      newArray​(int nArraySize, ELEMENTTYPE aValue, Class<ELEMENTTYPE> aClass)
      Create a new array with a predefined number of elements containing the passed value.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      newArray​(ELEMENTTYPE... aArray)
      Wrapper that allows vararg arguments and returns the array.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      newArray​(Class<? extends ELEMENTTYPE> aClass, int nSize)  
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      newArray​(Collection<? extends ELEMENTTYPE> aCollection, Class<ELEMENTTYPE> aClass)
      Create a new array with the elements in the passed collection..
      static <SRCTYPE,​DSTTYPE>
      DSTTYPE[]
      newArrayMapped​(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE,​? extends DSTTYPE> aMapper, Class<DSTTYPE> aDstClass)  
      static <SRCTYPE,​DSTTYPE>
      DSTTYPE[]
      newArrayMapped​(SRCTYPE[] aArray, Function<? super SRCTYPE,​? extends DSTTYPE> aMapper, Class<DSTTYPE> aDstClass)  
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      newArraySameType​(ELEMENTTYPE[] aArray, int nSize)
      Create a new empty array with the same type as the passed array.
      static <ELEMENTTYPE>
      ELEMENTTYPE[]
      newArraySingleElement​(ELEMENTTYPE aElement, Class<ELEMENTTYPE> aClass)
      Wrapper that allows a single argument to be treated as an array.
      static boolean[] newBooleanArray​(boolean... aArray)
      Helper method to easily create an array from constant values.
      static byte[] newByteArray​(byte... aArray)
      Helper method to easily create an array from constant values.
      static char[] newCharArray​(char... aArray)
      Helper method to easily create an array from constant values.
      static double[] newDoubleArray​(double... aArray)
      Helper method to easily create an array from constant values.
      static float[] newFloatArray​(float... aArray)
      Helper method to easily create an array from constant values.
      static int[] newIntArray​(int... aArray)
      Helper method to easily create an array from constant values.
      static long[] newLongArray​(long... aArray)
      Helper method to easily create an array from constant values.
      static short[] newShortArray​(short... aArray)
      Helper method to easily create an array from constant values.
      static boolean startsWith​(byte[] aArray, byte[] aSearch)  
      static boolean startsWith​(byte[] aArray, byte[] aSearch, int nSearchOfs, int nSearchLen)  
      static boolean startsWith​(byte[] aArray, int nArrayLen, byte[] aSearch)  
      static boolean startsWith​(byte[] aArray, int nArrayLen, byte[] aSearch, int nSearchOfs, int nSearchLen)  
      static boolean startsWith​(byte[] aArray, int nArrayOfs, int nArrayLen, byte[] aSearch, int nSearchOfs, int nSearchLen)  
      static boolean startsWith​(char[] aArray, char[] aSearch)  
      static boolean startsWith​(char[] aArray, char[] aSearch, int nSearchOfs, int nSearchLen)  
      static boolean startsWith​(char[] aArray, int nArrayLen, char[] aSearch)  
      static boolean startsWith​(char[] aArray, int nArrayLen, char[] aSearch, int nSearchOfs, int nSearchLen)  
      static boolean startsWith​(char[] aArray, int nArrayOfs, int nArrayLen, char[] aSearch, int nSearchOfs, int nSearchLen)  
    • Field Detail

      • EMPTY_BOOLEAN_ARRAY

        public static final boolean[] EMPTY_BOOLEAN_ARRAY
        Constant empty boolean array
      • EMPTY_BYTE_ARRAY

        public static final byte[] EMPTY_BYTE_ARRAY
        Constant empty byte array
      • EMPTY_CHAR_ARRAY

        public static final char[] EMPTY_CHAR_ARRAY
        Constant empty char array
      • EMPTY_DOUBLE_ARRAY

        public static final double[] EMPTY_DOUBLE_ARRAY
        Constant empty double array
      • EMPTY_FLOAT_ARRAY

        public static final float[] EMPTY_FLOAT_ARRAY
        Constant empty float array
      • EMPTY_INT_ARRAY

        public static final int[] EMPTY_INT_ARRAY
        Constant empty int array
      • EMPTY_LONG_ARRAY

        public static final long[] EMPTY_LONG_ARRAY
        Constant empty long array
      • EMPTY_SHORT_ARRAY

        public static final short[] EMPTY_SHORT_ARRAY
        Constant empty short array
      • EMPTY_BOOLEAN_OBJ_ARRAY

        public static final Boolean[] EMPTY_BOOLEAN_OBJ_ARRAY
        Constant empty boolean array
      • EMPTY_BYTE_OBJ_ARRAY

        public static final Byte[] EMPTY_BYTE_OBJ_ARRAY
        Constant empty byte array
      • EMPTY_CHAR_OBJ_ARRAY

        public static final Character[] EMPTY_CHAR_OBJ_ARRAY
        Constant empty char array
      • EMPTY_DOUBLE_OBJ_ARRAY

        public static final Double[] EMPTY_DOUBLE_OBJ_ARRAY
        Constant empty double array
      • EMPTY_FLOAT_OBJ_ARRAY

        public static final Float[] EMPTY_FLOAT_OBJ_ARRAY
        Constant empty float array
      • EMPTY_INT_OBJ_ARRAY

        public static final Integer[] EMPTY_INT_OBJ_ARRAY
        Constant empty int array
      • EMPTY_LONG_OBJ_ARRAY

        public static final Long[] EMPTY_LONG_OBJ_ARRAY
        Constant empty long array
      • EMPTY_SHORT_OBJ_ARRAY

        public static final Short[] EMPTY_SHORT_OBJ_ARRAY
        Constant empty short array
      • EMPTY_OBJECT_ARRAY

        public static final Object[] EMPTY_OBJECT_ARRAY
        Constant empty Object array
      • EMPTY_STRING_ARRAY

        public static final String[] EMPTY_STRING_ARRAY
        Constant empty String array
      • EMPTY_CLASS_ARRAY

        public static final Class<?>[] EMPTY_CLASS_ARRAY
        Constant empty Class<?> array
    • Method Detail

      • getComponentType

        @Nonnull
        public static <ELEMENTTYPE> Class<? extends ELEMENTTYPE> getComponentType​(@Nonnull
                                                                                  ELEMENTTYPE[] aArray)
        Get the component type of the array (the type of which the array is made up)
        Type Parameters:
        ELEMENTTYPE - The component type of the array
        Parameters:
        aArray - The array to get the type from. May not be null.
        Returns:
        The class that determines a single element of the array.
      • isArray

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

        @Nonnegative
        public static int getSize​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                  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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                      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​(@Nullable
                                         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​(@Nullable
                                         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​(@Nullable
                                         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​(@Nullable
                                         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​(@Nullable
                                         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​(@Nullable
                                         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​(@Nullable
                                         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​(@Nullable
                                         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.
      • 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​(@Nullable
                                        boolean[] aValues,
                                        boolean aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        byte[] aValues,
                                        byte aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        char[] aValues,
                                        char aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        double[] aValues,
                                        double aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        float[] aValues,
                                        float aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        int[] aValues,
                                        int aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        long[] aValues,
                                        long aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                        short[] aValues,
                                        short aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       boolean[] aValues,
                                       boolean aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       byte[] aValues,
                                       byte aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       char[] aValues,
                                       char aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       double[] aValues,
                                       double aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       float[] aValues,
                                       float aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       int[] aValues,
                                       int aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       long[] aValues,
                                       long aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       short[] aValues,
                                       short aSearchValue)
        Get the index of the passed search value in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       boolean[] aValues,
                                       boolean aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       byte[] aValues,
                                       byte aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       char[] aValues,
                                       char aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       double[] aValues,
                                       double aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       float[] aValues,
                                       float aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       int[] aValues,
                                       int aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       long[] aValues,
                                       long aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       short[] aValues,
                                       short aSearchValue)
        Check if the passed search value is contained in the passed value array.
        Parameters:
        aValues - The value array to be searched. May 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​(@Nullable
                                       boolean[] aArray,
                                       boolean aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                    byte[] aArray,
                                    byte aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                    char[] aArray,
                                    char aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                      double[] aArray,
                                      double aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                     float[] aArray,
                                     float aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                   int[] aArray,
                                   int aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                    long[] aArray,
                                    long aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                     short[] aArray,
                                     short aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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

        @Nullable
        @SafeVarargs
        public static <ELEMENTTYPE> 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

        @Nullable
        public static <ELEMENTTYPE> ELEMENTTYPE getFirst​(@Nullable
                                                         ELEMENTTYPE[] aArray,
                                                         @Nullable
                                                         ELEMENTTYPE aDefaultValue)
        Get the first element of the array or the passed default if the passed array is empty.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The array who's first element is to be retrieved. May 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​(@Nullable
                                      boolean[] aArray,
                                      boolean aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                   byte[] aArray,
                                   byte aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                   char[] aArray,
                                   char aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                     double[] aArray,
                                     double aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                    float[] aArray,
                                    float aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                  int[] aArray,
                                  int aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                   long[] aArray,
                                   long aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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​(@Nullable
                                    short[] aArray,
                                    short aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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

        @Nullable
        @SafeVarargs
        public static <ELEMENTTYPE> 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

        @Nullable
        public static <ELEMENTTYPE> ELEMENTTYPE getLast​(@Nullable
                                                        ELEMENTTYPE[] aArray,
                                                        @Nullable
                                                        ELEMENTTYPE aDefaultValue)
        Get the last element of the array or the passed default if the passed array is empty.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The array who's last element is to be retrieved. May 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.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getCopy​(@Nullable
                                        boolean... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getCopy​(@Nullable
                                        boolean[] aArray,
                                        @Nonnegative
                                        int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getCopy​(@Nullable
                                        boolean[] aArray,
                                        @Nonnegative
                                        int nStartIndex,
                                        @Nonnegative
                                        int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getCopy​(@Nullable
                                     byte... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getCopy​(@Nullable
                                     byte[] aArray,
                                     @Nonnegative
                                     int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getCopy​(@Nullable
                                     byte[] aArray,
                                     @Nonnegative
                                     int nStartIndex,
                                     @Nonnegative
                                     int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static char[] getCopy​(@Nullable
                                     char... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static char[] getCopy​(@Nullable
                                     char[] aArray,
                                     @Nonnegative
                                     int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static char[] getCopy​(@Nullable
                                     char[] aArray,
                                     @Nonnegative
                                     int nStartIndex,
                                     @Nonnegative
                                     int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static double[] getCopy​(@Nullable
                                       double... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static double[] getCopy​(@Nullable
                                       double[] aArray,
                                       @Nonnegative
                                       int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static double[] getCopy​(@Nullable
                                       double[] aArray,
                                       @Nonnegative
                                       int nStartIndex,
                                       @Nonnegative
                                       int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static float[] getCopy​(@Nullable
                                      float... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static float[] getCopy​(@Nullable
                                      float[] aArray,
                                      @Nonnegative
                                      int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static float[] getCopy​(@Nullable
                                      float[] aArray,
                                      @Nonnegative
                                      int nStartIndex,
                                      @Nonnegative
                                      int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static int[] getCopy​(@Nullable
                                    int... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static int[] getCopy​(@Nullable
                                    int[] aArray,
                                    @Nonnegative
                                    int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static int[] getCopy​(@Nullable
                                    int[] aArray,
                                    @Nonnegative
                                    int nStartIndex,
                                    @Nonnegative
                                    int nLength)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static long[] getCopy​(@Nullable
                                     long[] aArray,
                                     @Nonnegative
                                     int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static long[] getCopy​(@Nullable
                                     long[] aArray,
                                     @Nonnegative
                                     int nStartIndex,
                                     @Nonnegative
                                     int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static short[] getCopy​(@Nullable
                                      short... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static short[] getCopy​(@Nullable
                                      short[] aArray,
                                      @Nonnegative
                                      int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static short[] getCopy​(@Nullable
                                      short[] aArray,
                                      @Nonnegative
                                      int nStartIndex,
                                      @Nonnegative
                                      int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        @SafeVarargs
        public static <ELEMENTTYPE> ELEMENTTYPE[] getCopy​(@Nullable
                                                          ELEMENTTYPE... aArray)
        Get a 1:1 copy of the passed array. Nested elements are not deep-copied - the references are re-used!
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The array to be copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getCopy​(@Nullable
                                                          ELEMENTTYPE[] aArray,
                                                          @Nonnegative
                                                          int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements. Nested elements are not deep-copied - the references are re-used!
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The array to be copied.
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, only the available number of elements in the source array are copied.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
      • getCopy

        @Nullable
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getCopy​(@Nullable
                                                          ELEMENTTYPE[] aArray,
                                                          @Nonnegative
                                                          int nStartIndex,
                                                          @Nonnegative
                                                          int nLength)
        Get a 1:1 copy of the passed array using the passed number of array elements starting at the specified index. Nested elements are not deep-copied - the references are re-used!
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The array to be copied.
        nStartIndex - The index where the copying should start. Must be >= 0!
        nLength - The number of elements to be copied into the new array. May not be < 0. If the passed number of elements exceeds the number of elements in the array, an exception is thrown.
        Returns:
        null if the passed array is null - a non- null copy otherwise.
        See Also:
        System.arraycopy(Object, int, Object, int, int)
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getConcatenated​(@Nullable
                                                                  ELEMENTTYPE[] aHeadArray,
                                                                  @Nullable
                                                                  ELEMENTTYPE[] aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getConcatenated​(@Nullable
                                                                  ELEMENTTYPE aHead,
                                                                  @Nullable
                                                                  ELEMENTTYPE[] aTailArray,
                                                                  @Nonnull
                                                                  Class<ELEMENTTYPE> aClass)
        Get a new array that combines the passed head and the array. The head element will be the first element of the created array.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aHead - The first element of the result array. If this element 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

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getConcatenated​(@Nullable
                                                                  ELEMENTTYPE[] aHeadArray,
                                                                  @Nullable
                                                                  ELEMENTTYPE aTail,
                                                                  @Nonnull
                                                                  Class<ELEMENTTYPE> aClass)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aHeadArray - The head array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getConcatenated​(@Nullable
                                                boolean[] aHeadArray,
                                                @Nullable
                                                boolean... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static boolean[] getConcatenated​(boolean aHead,
                                                @Nullable
                                                boolean... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static boolean[] getConcatenated​(@Nullable
                                                boolean[] aHeadArray,
                                                boolean aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getConcatenated​(@Nullable
                                             byte[] aHeadArray,
                                             @Nullable
                                             byte... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static byte[] getConcatenated​(byte aHead,
                                             @Nullable
                                             byte... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static byte[] getConcatenated​(@Nullable
                                             byte[] aHeadArray,
                                             byte aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static char[] getConcatenated​(@Nullable
                                             char[] aHeadArray,
                                             @Nullable
                                             char... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static char[][] getConcatenated​(@Nullable
                                               char[][] aHeadArray,
                                               @Nullable
                                               char[]... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static char[] getConcatenated​(char aHead,
                                             @Nullable
                                             char... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static char[] getConcatenated​(@Nullable
                                             char[] aHeadArray,
                                             char aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static double[] getConcatenated​(@Nullable
                                               double[] aHeadArray,
                                               @Nullable
                                               double... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static double[] getConcatenated​(double aHead,
                                               @Nullable
                                               double... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static double[] getConcatenated​(@Nullable
                                               double[] aHeadArray,
                                               double aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static float[] getConcatenated​(@Nullable
                                              float[] aHeadArray,
                                              @Nullable
                                              float... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static float[] getConcatenated​(float aHead,
                                              @Nullable
                                              float... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static float[] getConcatenated​(@Nullable
                                              float[] aHeadArray,
                                              float aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static int[] getConcatenated​(@Nullable
                                            int[] aHeadArray,
                                            @Nullable
                                            int... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static int[] getConcatenated​(int aHead,
                                            @Nullable
                                            int... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static int[] getConcatenated​(@Nullable
                                            int[] aHeadArray,
                                            int aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static long[] getConcatenated​(@Nullable
                                             long[] aHeadArray,
                                             @Nullable
                                             long... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static long[] getConcatenated​(long aHead,
                                             @Nullable
                                             long... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static long[] getConcatenated​(@Nullable
                                             long[] aHeadArray,
                                             long aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nullable
        @ReturnsMutableCopy
        public static short[] getConcatenated​(@Nullable
                                              short[] aHeadArray,
                                              @Nullable
                                              short... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static short[] getConcatenated​(short aHead,
                                              @Nullable
                                              short... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static short[] getConcatenated​(@Nullable
                                              short[] aHeadArray,
                                              short aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static String[] getConcatenated​(@Nullable
                                               String[] aHeadArray,
                                               @Nullable
                                               String... aTailArray)
        Get a new array that combines the passed two arrays, maintaining the order.
        Parameters:
        aHeadArray - The first array. May 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

        @Nonnull
        @ReturnsMutableCopy
        public static String[] getConcatenated​(String aHead,
                                               @Nullable
                                               String... aTailArray)
        Get a new array that combines the passed head element and the array. The head element will be the first element of the created array.
        Parameters:
        aHead - The first element of the result array.
        aTailArray - The tail array. May be null.
        Returns:
        A non-null array with all elements in the correct order.
      • getConcatenated

        @Nonnull
        @ReturnsMutableCopy
        public static String[] getConcatenated​(@Nullable
                                               String[] aHeadArray,
                                               String aTail)
        Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array.
        Parameters:
        aHeadArray - The head array. May be null.
        aTail - The last element of the result array.
        Returns:
        A non-null array with all elements in the correct order.
      • getAllExceptFirst

        @Nullable
        @ReturnsMutableCopy
        @SafeVarargs
        public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptFirst​(@Nullable
                                                                    ELEMENTTYPE... aArray)
        Get an array that contains all elements, except for the first element.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptFirst​(@Nullable
                                                                    ELEMENTTYPE[] aArray,
                                                                    @Nonnegative
                                                                    int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        @SafeVarargs
        public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExcept​(@Nullable
                                                               ELEMENTTYPE[] aArray,
                                                               @Nullable
                                                               ELEMENTTYPE... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getAllExcept​(@Nullable
                                             boolean[] aArray,
                                             @Nullable
                                             boolean... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getAllExcept​(@Nullable
                                          byte[] aArray,
                                          @Nullable
                                          byte... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static char[] getAllExcept​(@Nullable
                                          char[] aArray,
                                          @Nullable
                                          char... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static double[] getAllExcept​(@Nullable
                                            double[] aArray,
                                            @Nullable
                                            double... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static float[] getAllExcept​(@Nullable
                                           float[] aArray,
                                           @Nullable
                                           float... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static int[] getAllExcept​(@Nullable
                                         int[] aArray,
                                         @Nullable
                                         int... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static long[] getAllExcept​(@Nullable
                                          long[] aArray,
                                          @Nullable
                                          long... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static short[] getAllExcept​(@Nullable
                                           short[] aArray,
                                           @Nullable
                                           short... aElementsToRemove)
        Get an array that contains all elements, except for the passed elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getAllExceptFirst​(@Nullable
                                                  boolean... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getAllExceptFirst​(@Nullable
                                                  boolean[] aArray,
                                                  @Nonnegative
                                                  int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getAllExceptFirst​(@Nullable
                                               byte... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getAllExceptFirst​(@Nullable
                                               byte[] aArray,
                                               @Nonnegative
                                               int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static char[] getAllExceptFirst​(@Nullable
                                               char... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static char[] getAllExceptFirst​(@Nullable
                                               char[] aArray,
                                               @Nonnegative
                                               int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static double[] getAllExceptFirst​(@Nullable
                                                 double... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static double[] getAllExceptFirst​(@Nullable
                                                 double[] aArray,
                                                 @Nonnegative
                                                 int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static float[] getAllExceptFirst​(@Nullable
                                                float... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static float[] getAllExceptFirst​(@Nullable
                                                float[] aArray,
                                                @Nonnegative
                                                int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static int[] getAllExceptFirst​(@Nullable
                                              int... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static int[] getAllExceptFirst​(@Nullable
                                              int[] aArray,
                                              @Nonnegative
                                              int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static long[] getAllExceptFirst​(@Nullable
                                               long... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static long[] getAllExceptFirst​(@Nullable
                                               long[] aArray,
                                               @Nonnegative
                                               int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static short[] getAllExceptFirst​(@Nullable
                                                short... aArray)
        Get an array that contains all elements, except for the first element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static short[] getAllExceptFirst​(@Nullable
                                                short[] aArray,
                                                @Nonnegative
                                                int nElementsToSkip)
        Get an array that contains all elements, except for the first n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        @SafeVarargs
        public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptLast​(@Nullable
                                                                   ELEMENTTYPE... aArray)
        Get an array that contains all elements, except for the last element.
        Type Parameters:
        ELEMENTTYPE - Array element type
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] getAllExceptLast​(@Nullable
                                                                   ELEMENTTYPE[] aArray,
                                                                   @Nonnegative
                                                                   int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Type Parameters:
        ELEMENTTYPE - Type of element
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getAllExceptLast​(@Nullable
                                                 boolean... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static boolean[] getAllExceptLast​(@Nullable
                                                 boolean[] aArray,
                                                 @Nonnegative
                                                 int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getAllExceptLast​(@Nullable
                                              byte... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static byte[] getAllExceptLast​(@Nullable
                                              byte[] aArray,
                                              @Nonnegative
                                              int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static char[] getAllExceptLast​(@Nullable
                                              char... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static char[] getAllExceptLast​(@Nullable
                                              char[] aArray,
                                              @Nonnegative
                                              int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static double[] getAllExceptLast​(@Nullable
                                                double... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static double[] getAllExceptLast​(@Nullable
                                                double[] aArray,
                                                @Nonnegative
                                                int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static float[] getAllExceptLast​(@Nullable
                                               float... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static float[] getAllExceptLast​(@Nullable
                                               float[] aArray,
                                               @Nonnegative
                                               int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static int[] getAllExceptLast​(@Nullable
                                             int... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static int[] getAllExceptLast​(@Nullable
                                             int[] aArray,
                                             @Nonnegative
                                             int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static long[] getAllExceptLast​(@Nullable
                                              long... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static long[] getAllExceptLast​(@Nullable
                                              long[] aArray,
                                              @Nonnegative
                                              int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static short[] getAllExceptLast​(@Nullable
                                               short... aArray)
        Get an array that contains all elements, except for the last element.
        Parameters:
        aArray - The source array. May 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

        @Nullable
        @ReturnsMutableCopy
        public static short[] getAllExceptLast​(@Nullable
                                               short[] aArray,
                                               @Nonnegative
                                               int nElementsToSkip)
        Get an array that contains all elements, except for the last n elements.
        Parameters:
        aArray - The source array. May 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.
      • newBooleanArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static boolean[] newBooleanArray​(@Nullable
                                                boolean... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newByteArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static byte[] newByteArray​(@Nullable
                                          byte... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newCharArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static char[] newCharArray​(@Nullable
                                          char... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newDoubleArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static double[] newDoubleArray​(@Nullable
                                              double... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newFloatArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static float[] newFloatArray​(@Nullable
                                            float... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newIntArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static int[] newIntArray​(@Nullable
                                        int... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newLongArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static long[] newLongArray​(@Nullable
                                          long... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newShortArray

        @Nullable
        @ReturnsMutableObject("use getCopy otherwise")
        public static short[] newShortArray​(@Nullable
                                            short... aArray)
        Helper method to easily create an array from constant values.
        Parameters:
        aArray - The list of values for the array. May be null.
        Returns:
        The passed array. null if the passed array was null.
      • newArraySameType

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] newArraySameType​(@Nonnull
                                                                   ELEMENTTYPE[] aArray,
                                                                   @Nonnegative
                                                                   int nSize)
        Create a new empty array with the same type as the passed array.
        Type Parameters:
        ELEMENTTYPE - Type of element
        Parameters:
        aArray - Source array. May not be null.
        nSize - Destination size. Must be ≥ 0.
        Returns:
        Never null.
      • newArray

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] newArray​(@Nullable
                                                           Collection<? extends ELEMENTTYPE> aCollection,
                                                           @Nonnull
                                                           Class<ELEMENTTYPE> aClass)
        Create a new array with the elements in the passed collection..
        Type Parameters:
        ELEMENTTYPE - Type of element
        Parameters:
        aCollection - The collection to be converted to an array. May 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.
      • newArraySingleElement

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] newArraySingleElement​(@Nullable
                                                                        ELEMENTTYPE aElement,
                                                                        @Nonnull
                                                                        Class<ELEMENTTYPE> aClass)
        Wrapper that allows a single argument to be treated as an array.
        Type Parameters:
        ELEMENTTYPE - Type of element
        Parameters:
        aElement - The element to be converted to an array. May 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.
      • newArray

        @Nonnull
        @ReturnsMutableObject("use getCopy otherwise")
        @SafeVarargs
        public static <ELEMENTTYPE> ELEMENTTYPE[] newArray​(@Nonnull
                                                           ELEMENTTYPE... aArray)
        Wrapper that allows vararg arguments and returns the array.
        Note: this implementation is not available for basic types, because the Eclipse compiler seems to have difficulties resolving vararg types correctly.
        Type Parameters:
        ELEMENTTYPE - Type of element
        Parameters:
        aArray - The vararg array
        Returns:
        The wrapped array
      • newArray

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> ELEMENTTYPE[] newArray​(@Nonnegative
                                                           int nArraySize,
                                                           @Nonnull
                                                           ELEMENTTYPE aValue,
                                                           @Nonnull
                                                           Class<ELEMENTTYPE> aClass)
        Create a new array with a predefined number of elements containing the passed value.
        Type Parameters:
        ELEMENTTYPE - The type of the array to be created.
        Parameters:
        nArraySize - The size of the array to be created.
        aValue - The value to be set into each array element. May 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.
      • getAsObjectArray

        @Nullable
        @ReturnsMutableCopy
        public static 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

        @Nullable
        public static <ELEMENTTYPE> ELEMENTTYPE getSafeElement​(@Nullable
                                                               ELEMENTTYPE[] aItems,
                                                               int nIndex)
      • getSafeElement

        @Nullable
        public static <ELEMENTTYPE> ELEMENTTYPE getSafeElement​(@Nullable
                                                               ELEMENTTYPE[] aItems,
                                                               int nIndex,
                                                               @Nullable
                                                               ELEMENTTYPE aDefault)
      • isArrayEquals

        public static boolean isArrayEquals​(@Nullable
                                            Object aHeadArray,
                                            @Nullable
                                            Object aTailArray)
        Recursive equal comparison for arrays.
        Parameters:
        aHeadArray - First array. May 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.
      • containsAny

        public static <ELEMENTTYPE> boolean containsAny​(@Nullable
                                                        ELEMENTTYPE[] aArray,
                                                        @Nullable
                                                        Predicate<? super ELEMENTTYPE> aFilter)
      • forEach

        public static <ELEMENTTYPE> void forEach​(@Nullable
                                                 ELEMENTTYPE[] aArray,
                                                 @Nonnull
                                                 Consumer<? super ELEMENTTYPE> aConsumer)
      • startsWith

        public static boolean startsWith​(@Nonnull
                                         byte[] aArray,
                                         @Nullable
                                         byte[] aSearch)
      • startsWith

        public static boolean startsWith​(@Nonnull
                                         char[] aArray,
                                         @Nullable
                                         char[] aSearch)