public final class ArrayUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
contains(byte data,
byte[] array)
Returns whether array contains the specified byte or not.
|
static boolean |
contains(char character,
char[] array)
Returns whether array contains the specified character or not.
|
static boolean |
contains(double number,
double[] array)
Returns whether array contains the specified number or not.
|
static boolean |
contains(float number,
float[] array)
Returns whether array contains the specified number or not.
|
static boolean |
contains(int number,
int[] array)
Returns whether array contains the specified number or not.
|
static boolean |
contains(long number,
long[] array)
Returns whether array contains the specified number or not.
|
static boolean |
contains(Object object,
Object[] array)
Returns whether array contains the specified object or not.
|
static boolean |
contains(String text,
String[] array)
Returns whether array contains the specified text or not.
|
static <T> T[] |
createArray(Class<T> classType,
int length)
Returns new array with the specified component class type.
|
static <T> T[] |
createArray(T[] array,
int length)
Returns new array with the component class type from the specified array.
|
static boolean |
equals(byte[] array1,
byte[] array2)
Returns whether arrays are equal or not.
|
static boolean |
equals(char[] array1,
char[] array2)
Returns whether arrays are equal or not.
|
static boolean |
equals(double[] array1,
double[] array2)
Returns whether arrays are equal or not.
|
static boolean |
equals(float[] array1,
float[] array2)
Returns whether arrays are equal or not.
|
static boolean |
equals(int[] array1,
int[] array2)
Returns whether arrays are equal or not.
|
static boolean |
equals(long[] array1,
long[] array2)
Returns whether arrays are equal or not.
|
static boolean |
equals(String[] array1,
String[] array2)
Returns whether arrays are equal or not.
|
static <T> boolean |
equals(T[] array1,
T[] array2)
Returns whether arrays are equal or not.
|
static int |
indexOf(byte data,
byte[] array)
Returns index of specified byte in array.
|
static int |
indexOf(char character,
char[] array)
Returns index of specified character in array.
|
static int |
indexOf(double number,
double[] array)
Returns index of specified double in array.
|
static int |
indexOf(float number,
float[] array)
Returns index of specified float in array.
|
static int |
indexOf(int number,
int[] array)
Returns index of specified int in array.
|
static int |
indexOf(long number,
long[] array)
Returns index of specified long in array.
|
static int |
indexOf(Object object,
Object[] array)
Returns index of specified object in array.
|
static int |
indexOf(String text,
String[] array)
Returns index of specified text in array.
|
static int |
indexOf(String text,
String[] array,
boolean ignoreCase)
Returns index of specified text in array.
|
static boolean[] |
insert(boolean[] array,
int index,
boolean object)
Returns new array with boolean inserted at the specified index.
|
static byte[] |
insert(byte[] array,
int index,
byte object)
Returns new array with byte inserted at the specified index.
|
static char[] |
insert(char[] array,
int index,
char object)
Returns new array with char inserted at the specified index.
|
static double[] |
insert(double[] array,
int index,
double object)
Returns new array with double inserted at the specified index.
|
static float[] |
insert(float[] array,
int index,
float object)
Returns new array with float inserted at the specified index.
|
static int[] |
insert(int[] array,
int index,
int object)
Returns new array with int inserted at the specified index.
|
static <T> T[] |
insert(T[] array,
int index,
T object)
Returns new array with object inserted at the specified index.
|
static <T> boolean |
isEmpty(T... data)
Returns whether or not data is empty.
|
static int |
lastIndexOf(Object object,
Object[] array)
Returns last index of specified object in array.
|
static <T> boolean |
notEmpty(T... data)
Returns whether or not data is empty.
|
static boolean[] |
remove(boolean[] array,
int index)
Returns new array with the boolean under specified index removed.
|
static byte[] |
remove(byte[] array,
int index)
Returns new array with the byte under specified index removed.
|
static char[] |
remove(char[] array,
int index)
Returns new array with the char under specified index removed.
|
static double[] |
remove(double[] array,
int index)
Returns new array with the double under specified index removed.
|
static float[] |
remove(float[] array,
int index)
Returns new array with the float under specified index removed.
|
static int[] |
remove(int[] array,
int index)
Returns new array with the int under specified index removed.
|
static <T> T[] |
remove(T[] array,
int index)
Returns new array with the object under specified index removed.
|
static <T> T[] |
remove(T[] array,
T object)
Returns new array with the specified object removed.
|
static <T> T |
roundRobin(int index,
T... items)
Returns item from the array at the specified index.
|
public static <T> boolean isEmpty(@Nullable T... data)
T - data typedata - datatrue if data is empty, false otherwisepublic static <T> boolean notEmpty(@Nullable T... data)
T - data typedata - datatrue if data is not empty, false otherwisepublic static boolean contains(int number,
@NotNull
int[] array)
number - number to findarray - array to processtrue if array contains the specified number, false otherwisepublic static boolean contains(long number,
@NotNull
long[] array)
number - number to findarray - array to processtrue if array contains the specified number, false otherwisepublic static boolean contains(float number,
@NotNull
float[] array)
number - number to findarray - array to processtrue if array contains the specified number, false otherwisepublic static boolean contains(double number,
@NotNull
double[] array)
number - number to findarray - array to processtrue if array contains the specified number, false otherwisepublic static boolean contains(char character,
@NotNull
char[] array)
character - character to findarray - array to processtrue if array contains the specified character, false otherwisepublic static boolean contains(byte data,
@NotNull
byte[] array)
data - byte to findarray - array to processtrue if array contains the specified byte, false otherwisepublic static boolean contains(@Nullable String text, @NotNull String[] array)
text - text to findarray - array to processtrue if array contains the specified text, false otherwisepublic static boolean contains(@Nullable Object object, @NotNull Object[] array)
object - object to findarray - array to processtrue if array contains the specified object, false otherwisepublic static int indexOf(int number,
@NotNull
int[] array)
number - int to findarray - array to processpublic static int indexOf(long number,
@NotNull
long[] array)
number - long to findarray - array to processpublic static int indexOf(float number,
@NotNull
float[] array)
number - float to findarray - array to processpublic static int indexOf(double number,
@NotNull
double[] array)
number - double to findarray - array to processpublic static int indexOf(char character,
@NotNull
char[] array)
character - character to findarray - array to processpublic static int indexOf(byte data,
@NotNull
byte[] array)
data - byte to findarray - array to processpublic static int indexOf(@Nullable String text, @NotNull String[] array)
text - text to findarray - array to processpublic static int indexOf(@Nullable String text, @NotNull String[] array, boolean ignoreCase)
text - text to findarray - array to processignoreCase - whether ignore text case or notpublic static int indexOf(@Nullable Object object, @NotNull Object[] array)
object - object to findarray - array to processpublic static int lastIndexOf(@Nullable Object object, @NotNull Object[] array)
object - object to findarray - array to process@NotNull public static <T> T[] remove(@NotNull T[] array, @Nullable T object)
T - data typearray - array to processobject - object to remove@NotNull public static int[] remove(@NotNull int[] array, int index)
array - array to processindex - index of int to remove@NotNull public static float[] remove(@NotNull float[] array, int index)
array - array to processindex - index of float to remove@NotNull public static double[] remove(@NotNull double[] array, int index)
array - array to processindex - index of double to remove@NotNull public static char[] remove(@NotNull char[] array, int index)
array - array to processindex - index of char to remove@NotNull public static byte[] remove(@NotNull byte[] array, int index)
array - array to processindex - index of byte to remove@NotNull public static boolean[] remove(@NotNull boolean[] array, int index)
array - array to processindex - index of boolean to remove@NotNull public static <T> T[] remove(@NotNull T[] array, int index)
T - data typearray - array to processindex - index of object to remove@NotNull public static int[] insert(@NotNull int[] array, int index, int object)
array - array to processindex - insert indexobject - int to insert@NotNull public static float[] insert(@NotNull float[] array, int index, float object)
array - array to processindex - insert indexobject - float to insert@NotNull public static double[] insert(@NotNull double[] array, int index, double object)
array - array to processindex - insert indexobject - double to insert@NotNull public static char[] insert(@NotNull char[] array, int index, char object)
array - array to processindex - insert indexobject - char to insert@NotNull public static byte[] insert(@NotNull byte[] array, int index, byte object)
array - array to processindex - insert indexobject - byte to insert@NotNull public static boolean[] insert(@NotNull boolean[] array, int index, boolean object)
array - array to processindex - insert indexobject - boolean to insert@NotNull public static <T> T[] insert(@NotNull T[] array, int index, @Nullable T object)
T - data typearray - array to processindex - insert indexobject - object to insert@NotNull public static <T> T[] createArray(@NotNull T[] array, int length)
T - data typearray - array to retrieve class type fromlength - array length@NotNull public static <T> T[] createArray(@NotNull Class<T> classType, int length)
T - data typeclassType - component class typelength - array lengthpublic static boolean equals(@Nullable int[] array1, @Nullable int[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static boolean equals(@Nullable long[] array1, @Nullable long[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static boolean equals(@Nullable float[] array1, @Nullable float[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static boolean equals(@Nullable double[] array1, @Nullable double[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static boolean equals(@Nullable char[] array1, @Nullable char[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static boolean equals(@Nullable byte[] array1, @Nullable byte[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static boolean equals(@Nullable String[] array1, @Nullable String[] array2)
array1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwisepublic static <T> boolean equals(@Nullable T[] array1, @Nullable T[] array2)
T - data typearray1 - first arrayarray2 - second arraytrue if arrays are equal, false otherwise@Nullable public static <T> T roundRobin(int index, @NotNull T... items)
T - item typeindex - index in the array or a number larger than array size, cannot be less than zeroitems - array itemsCopyright © 2020. All rights reserved.