Package net.risingworld.api.utils
Class Utils.ArrayUtils
java.lang.Object
net.risingworld.api.utils.Utils.ArrayUtils
- Enclosing class:
Utils
Contains various array-related helper methods.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
append
(byte[] array, byte value) static int[]
append
(int[] array, int value) static String[]
static boolean
contains
(byte[] array, byte value) Checks if an array contains the specified byte value.static boolean
contains
(char[] array, char value) Checks if an array contains the specified char value.static boolean
contains
(double[] array, double value) Checks if an array contains the specified double value.static boolean
contains
(float[] array, float value) Checks if an array contains the specified float value.static boolean
contains
(int[] array, int value) Checks if an array contains the specified int value.static boolean
contains
(long[] array, long value) Checks if an array contains the specified long value.static boolean
contains
(short[] array, short value) Checks if an array contains the specified short value.static <T> boolean
contains
(T[] array, T value) Checks if an array contains the specified value.static int
indexOf
(byte[] array, byte value) Gets the index of the specified byte value in the provided array.static int
indexOf
(char[] array, char value) Gets the index of the specified char value in the provided array.static int
indexOf
(double[] array, double value) Gets the index of the specified double value in the provided array.static int
indexOf
(float[] array, float value) Gets the index of the specified float value in the provided array.static int
indexOf
(int[] array, int value) Gets the index of the specified int value in the provided array.static int
indexOf
(long[] array, long value) Gets the index of the specified long value in the provided array.static int
indexOf
(short[] array, short value) Gets the index of the specified short value in the provided array.static <T> int
indexOf
(T[] array, T value) Gets the index of the specified value in the provided array.static int[]
removeEntries
(int[] array, int value) static String[]
removeEntries
(String[] array, String value) static byte[]
resize
(byte[] array, int newLength) static int[]
resize
(int[] array, int newLength) static String[]
static <T> void
shiftRight
(T[] array, int start, int end) static void
shuffle
(int[] array, int from, int to)
-
Constructor Details
-
ArrayUtils
public ArrayUtils()
-
-
Method Details
-
contains
public static <T> boolean contains(T[] array, T value) Checks if an array contains the specified value.- Type Parameters:
T
- type of array elements.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(byte[] array, byte value) Checks if an array contains the specified byte value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(char[] array, char value) Checks if an array contains the specified char value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(short[] array, short value) Checks if an array contains the specified short value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(int[] array, int value) Checks if an array contains the specified int value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(long[] array, long value) Checks if an array contains the specified long value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(float[] array, float value) Checks if an array contains the specified float value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
contains
public static boolean contains(double[] array, double value) Checks if an array contains the specified double value.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- true if the array contains the value, false if not.
-
indexOf
public static int indexOf(byte[] array, byte value) Gets the index of the specified byte value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static int indexOf(char[] array, char value) Gets the index of the specified char value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static int indexOf(short[] array, short value) Gets the index of the specified short value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static int indexOf(int[] array, int value) Gets the index of the specified int value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static int indexOf(float[] array, float value) Gets the index of the specified float value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static int indexOf(long[] array, long value) Gets the index of the specified long value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static int indexOf(double[] array, double value) Gets the index of the specified double value in the provided array.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
indexOf
public static <T> int indexOf(T[] array, T value) Gets the index of the specified value in the provided array.- Type Parameters:
T
- type of array elements.- Parameters:
array
- the array.value
- the value you're looking for.- Returns:
- the index of the value in the array, or -1 if it could not be found.
-
shiftRight
public static <T> void shiftRight(T[] array, int start, int end) -
append
-
append
public static int[] append(int[] array, int value) -
append
public static byte[] append(byte[] array, byte value) -
resize
-
resize
public static int[] resize(int[] array, int newLength) -
resize
public static byte[] resize(byte[] array, int newLength) -
removeEntries
-
removeEntries
public static int[] removeEntries(int[] array, int value) -
shuffle
public static void shuffle(int[] array, int from, int to)
-