Class ArrayUtils

java.lang.Object
net.minestom.server.utils.ArrayUtils

public final class ArrayUtils
extends java.lang.Object
  • Method Summary

    Modifier and Type Method Description
    static int[] concatenateIntArrays​(int[]... arrays)  
    static void copyToDestination​(short[] src, short[] dest)  
    static <T> void fill​(T[] array, java.util.function.Supplier<T> supplier)
    Fills an array using a supplier.
    static int[] getDifferencesBetweenArray​(long[] a, long[] b)
    Gets the differences between 2 arrays.
    static void removeElement​(java.lang.Object[] arr, int index)  
    static <T> boolean sameStart​(T[] array1, T[] array2, int length)
    Gets if two arrays share the same start until length.
    static int[] toArray​(it.unimi.dsi.fastutil.ints.IntList list)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • concatenateIntArrays

      public static int[] concatenateIntArrays​(@NotNull int[]... arrays)
    • removeElement

      public static void removeElement​(@NotNull java.lang.Object[] arr, int index)
    • copyToDestination

      public static void copyToDestination​(short[] src, short[] dest)
    • getDifferencesBetweenArray

      @NotNull public static int[] getDifferencesBetweenArray​(@NotNull long[] a, @NotNull long[] b)
      Gets the differences between 2 arrays.
      Parameters:
      a - the first array
      b - the second array
      Returns:
      an array containing a's indexes that aren't in b array
    • toArray

      @NotNull public static int[] toArray​(@NotNull it.unimi.dsi.fastutil.ints.IntList list)
    • sameStart

      public static <T> boolean sameStart​(T[] array1, T[] array2, int length)
      Gets if two arrays share the same start until length.
      Type Parameters:
      T - the type of the arrays
      Parameters:
      array1 - the first array
      array2 - the second array
      length - the length to check (0-length)
      Returns:
      true if both arrays share the same start
    • fill

      public static <T> void fill​(@NotNull T[] array, @NotNull java.util.function.Supplier<T> supplier)
      Fills an array using a supplier.
      Type Parameters:
      T - the array type
      Parameters:
      array - the array to fill
      supplier - the supplier to fill the array