Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- emptyArray()
- emptySupplierArray()
- emptyEntryArray()
- grow(int)
- copyAndMutate(StartType[], Function, IntFunction)
- combine(T[], T[])
- append(T[], T)
- remove(T[], int)
- startsWith(byte[], byte[])
- equals(T[], T[], UnaryBiPredicate)
- split(T[], int)
- split(byte[], int)
- shuffleArray(int[], int, int, Random)
- shuffleArray(byte[], int, int, Random)
- contains(T[], T)
- contains(T[], T, int, int)
- indexOf(T[], T)
- indexOf(T[], T, int, int)
Class ArrayUtil
java.lang.Object
com.hypixel.hytale.common.util.ArrayUtil
- Since:
- 14.08.2016
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]append(T[] arr, T t) static <T> T[]combine(T[] a1, T[] a2) static <T> booleancontains(T[] array, T obj) static <T> booleancontains(T[] array, T obj, int start, int end) static <StartType, EndType>
EndType[]copyAndMutate(StartType[] array, Function<StartType, EndType> adapter, IntFunction<EndType[]> arrayProvider) static <T> T[]static <K,V> Map.Entry<K, V>[] static <T> Supplier<T>[]static <T> booleanequals(T[] a, T[] a2, UnaryBiPredicate<T> predicate) Returns true if the two specified arrays of Objects are equal to one another as specified by the provided predicate.static intgrow(int oldSize) Provides a calculation for growing arrays.static <T> intindexOf(T[] array, T obj) static <T> intindexOf(T[] array, T obj, int start, int end) static <T> T[]remove(T[] arr, int index) static voidshuffleArray(byte[] ar, int from, int to, Random rnd) static voidshuffleArray(int[] ar, int from, int to, Random rnd) static byte[][]split(byte[] data, int size) static <T> T[][]split(T[] data, int size) static booleanstartsWith(byte[] array, byte[] start)
-
Field Details
-
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
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY -
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
-
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 equalitya2- the other array to be tested for equalitypredicate- 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
-
shuffleArray
-
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)
-