All Implemented Interfaces:
IArrsConstants

public final class Arrs extends ArrsPrimitive
Utility class for handling arrays
  • Method Details

    • toUnsafeObjectArray

      public static Object @NotNull [] toUnsafeObjectArray(@NotNull @NotNull Object array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
      Throws:
      IllegalArgumentException - Error if the object is not valid array
    • toObjectArray

      public static <T> Object @NotNull [] toObjectArray(T @NotNull [] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Type Parameters:
      T - the data type of the array
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Boolean @NotNull [] toObjectArray(boolean[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Character @NotNull [] toObjectArray(char[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Byte @NotNull [] toObjectArray(byte[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Short @NotNull [] toObjectArray(short[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Integer @NotNull [] toObjectArray(int[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Long @NotNull [] toObjectArray(long[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Float @NotNull [] toObjectArray(float[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object
    • toObjectArray

      public static Double @NotNull [] toObjectArray(double[] array)
      Convert any array to object array. This also applies to primitive types.

      Examples

      
       // For numeric primitives always use Number class
       Integer[] intArr = (Integer[]) ArraysImpl.toObjectArray(new int[] {2, 4, 6, 8});
       Short[] shortArr = (Short[]) ArraysImpl.toObjectArray(new short[] {12, 21, 42, 120, 0xFF});
       Float[] floatArr = (Float[]) ArraysImpl.toObjectArray(new float[] {1f, 2f, 3f, 120.2234f});
       // Wrapped clases
       Boolean[] boolArr = (Boolean[]) ArraysImpl.toObjectArray(new boolean[] {true, false, false, true});
       Character[] intArr = (Character[]) ArraysImpl.toObjectArray(new char[] {'H', 'e', 'l', 'l', 'o'});
       
      Parameters:
      array - the array to convert
      Returns:
      a converted array object