Class Arrays2


  • public final class Arrays2
    extends Object

    Convenience methods for creating object and primitive arrays.

    Author:
    David B. Bracewell
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T[] arrayOf​(T... objects)
      Creates an array of Objects
      static boolean[] arrayOfBoolean​(boolean... values)
      Creates an array of boolean values
      static byte[] arrayOfByte​(byte... values)
      Creates an array of byte values
      static byte[] arrayOfByte​(int... values)
      Creates an array of byte values
      static char[] arrayOfChar​(char... values)
      Creates an array of character values
      static double[] arrayOfDouble​(double... values)
      Creates an array of double values
      static float[] arrayOfFloat​(float... values)
      Creates an array of float values
      static int[] arrayOfInt​(int... values)
      Creates an array integer values
      static long[] arrayOfLong​(long... values)
      Creates an array of long values
      static short[] arrayOfShort​(int... values)
      Creates an array of short values
      static short[] arrayOfShort​(short... values)
      Creates an array of short values
      static boolean[] concat​(@lombok.NonNull boolean[] a1, @lombok.NonNull boolean[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static byte[] concat​(@lombok.NonNull byte[] a1, @lombok.NonNull byte[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static char[] concat​(@lombok.NonNull char[] a1, @lombok.NonNull char[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static double[] concat​(@lombok.NonNull double[] a1, @lombok.NonNull double[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static float[] concat​(@lombok.NonNull float[] a1, @lombok.NonNull float[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static int[] concat​(@lombok.NonNull int[] a1, @lombok.NonNull int[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static long[] concat​(@lombok.NonNull long[] a1, @lombok.NonNull long[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static short[] concat​(@lombok.NonNull short[] a1, @lombok.NonNull short[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
      static Object[] concat​(@NonNull Object[] a1, @NonNull Object[] a2)
      Creates a new array whose values are the concatenation of the first and second arrays.
    • Method Detail

      • arrayOf

        @SafeVarargs
        public static <T> T[] arrayOf​(T... objects)
        Creates an array of Objects
        Type Parameters:
        T - the object type parameter
        Parameters:
        objects - the objects
        Returns:
        the array
      • arrayOfBoolean

        public static boolean[] arrayOfBoolean​(boolean... values)
        Creates an array of boolean values
        Parameters:
        values - the values
        Returns:
        the boolean array
      • arrayOfByte

        public static byte[] arrayOfByte​(int... values)
        Creates an array of byte values
        Parameters:
        values - the values
        Returns:
        the byte array
      • arrayOfByte

        public static byte[] arrayOfByte​(byte... values)
        Creates an array of byte values
        Parameters:
        values - the values
        Returns:
        the byte array
      • arrayOfChar

        public static char[] arrayOfChar​(char... values)
        Creates an array of character values
        Parameters:
        values - the values
        Returns:
        the character array
      • arrayOfDouble

        public static double[] arrayOfDouble​(double... values)
        Creates an array of double values
        Parameters:
        values - the values
        Returns:
        the double array
      • arrayOfFloat

        public static float[] arrayOfFloat​(float... values)
        Creates an array of float values
        Parameters:
        values - the values
        Returns:
        the float array
      • arrayOfInt

        public static int[] arrayOfInt​(int... values)
        Creates an array integer values
        Parameters:
        values - the values
        Returns:
        the int array
      • arrayOfLong

        public static long[] arrayOfLong​(long... values)
        Creates an array of long values
        Parameters:
        values - the values
        Returns:
        the long values
      • arrayOfShort

        public static short[] arrayOfShort​(int... values)
        Creates an array of short values
        Parameters:
        values - the values
        Returns:
        the short values
      • arrayOfShort

        public static short[] arrayOfShort​(short... values)
        Creates an array of short values
        Parameters:
        values - the values
        Returns:
        the short values
      • concat

        public static byte[] concat​(@NonNull
                                    @lombok.NonNull byte[] a1,
                                    @NonNull
                                    @lombok.NonNull byte[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static int[] concat​(@NonNull
                                   @lombok.NonNull int[] a1,
                                   @NonNull
                                   @lombok.NonNull int[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static float[] concat​(@NonNull
                                     @lombok.NonNull float[] a1,
                                     @NonNull
                                     @lombok.NonNull float[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static double[] concat​(@NonNull
                                      @lombok.NonNull double[] a1,
                                      @NonNull
                                      @lombok.NonNull double[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static short[] concat​(@NonNull
                                     @lombok.NonNull short[] a1,
                                     @NonNull
                                     @lombok.NonNull short[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static long[] concat​(@NonNull
                                    @lombok.NonNull long[] a1,
                                    @NonNull
                                    @lombok.NonNull long[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static boolean[] concat​(@NonNull
                                       @lombok.NonNull boolean[] a1,
                                       @NonNull
                                       @lombok.NonNull boolean[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static char[] concat​(@NonNull
                                    @lombok.NonNull char[] a1,
                                    @NonNull
                                    @lombok.NonNull char[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values
      • concat

        public static Object[] concat​(@NonNull
                                      @NonNull Object[] a1,
                                      @NonNull
                                      @NonNull Object[] a2)
        Creates a new array whose values are the concatenation of the first and second arrays.
        Parameters:
        a1 - the first array
        a2 - the second array
        Returns:
        the new array of concatenated values