Class ArrayUtil

java.lang.Object
com.hypixel.hytale.common.util.ArrayUtil

public class ArrayUtil extends Object
Since:
14.08.2016
  • Field Details

    • EMPTY_STRING_ARRAY

      public static final String[] EMPTY_STRING_ARRAY
    • EMPTY_DOUBLE_ARRAY

      public static final double[] EMPTY_DOUBLE_ARRAY
    • EMPTY_INT_ARRAY

      public static final int[] EMPTY_INT_ARRAY
    • EMPTY_LONG_ARRAY

      public static final long[] EMPTY_LONG_ARRAY
    • EMPTY_BOOLEAN_ARRAY

      public static final boolean[] EMPTY_BOOLEAN_ARRAY
    • EMPTY_INTEGER_ARRAY

      public static final Integer[] EMPTY_INTEGER_ARRAY
    • EMPTY_BYTE_ARRAY

      public static final byte[] EMPTY_BYTE_ARRAY
    • EMPTY_BITSET_ARRAY

      public static final BitSet[] EMPTY_BITSET_ARRAY
    • EMPTY_FLOAT_ARRAY

      public static final float[] EMPTY_FLOAT_ARRAY
  • Constructor Details

    • ArrayUtil

      public ArrayUtil()
  • Method Details

    • emptyArray

      @Nonnull public static <T> T[] emptyArray()
    • emptySupplierArray

      @Nonnull public static <T> Supplier<T>[] emptySupplierArray()
    • emptyEntryArray

      @Nonnull public static <K,V> Map.Entry<K,V>[] emptyEntryArray()
    • grow

      public static int grow(int oldSize)
      Provides a calculation for growing arrays.
      Parameters:
      oldSize - the old size of the array.
      Returns:
      the new size of the array. (Maximum of Arrays.MAX_ARRAY_SIZE)
    • copyAndMutate

      public static <StartType, EndType> EndType[] copyAndMutate(@Nullable StartType[] array, @Nonnull Function<StartType, EndType> adapter, @Nonnull IntFunction<EndType[]> arrayProvider)
    • combine

      @Nullable public static <T> T[] combine(@Nullable T[] a1, @Nullable T[] a2)
    • append

      @Nonnull public static <T> T[] append(@Nullable T[] arr, @Nonnull T t)
    • remove

      @Nonnull public static <T> T[] remove(@Nonnull T[] arr, int index)
    • startsWith

      public static boolean startsWith(@Nonnull byte[] array, @Nonnull byte[] start)
    • equals

      public static <T> boolean equals(@Nullable T[] a, @Nullable T[] a2, @Nonnull UnaryBiPredicate<T> predicate)
      Returns true if the two specified arrays of Objects are equal to one another as specified by the provided predicate. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. Two objects e1 and e2 are considered equal if (e1==null ? e2==null : e1.equals(e2)). In other words, the two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.

      Type Parameters:
      T - The type of the array
      Parameters:
      a - one array to be tested for equality
      a2 - the other array to be tested for equality
      predicate - The tester
      Returns:
      true if the two arrays are equal
    • split

      @Nonnull public static <T> T[][] split(@Nonnull T[] data, int size)
    • split

      public static byte[][] split(@Nonnull byte[] data, int size)
    • shuffleArray

      public static void shuffleArray(@Nonnull int[] ar, int from, int to, @Nonnull Random rnd)
    • shuffleArray

      public static void shuffleArray(@Nonnull byte[] ar, int from, int to, @Nonnull Random rnd)
    • contains

      public static <T> boolean contains(@Nonnull T[] array, @Nullable T obj)
    • contains

      public static <T> boolean contains(@Nonnull T[] array, @Nullable T obj, int start, int end)
    • indexOf

      public static <T> int indexOf(@Nonnull T[] array, @Nullable T obj)
    • indexOf

      public static <T> int indexOf(@Nonnull T[] array, @Nullable T obj, int start, int end)