| 构造器和说明 |
|---|
ArrayKit() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean[] |
addAll(boolean[] array1,
boolean[] array2) |
static byte[] |
addAll(byte[] array1,
byte[] array2) |
static char[] |
addAll(char[] array1,
char[] array2) |
static double[] |
addAll(double[] array1,
double[] array2) |
static float[] |
addAll(float[] array1,
float[] array2) |
static int[] |
addAll(int[] array1,
int[] array2) |
static long[] |
addAll(long[] array1,
long[] array2) |
static short[] |
addAll(short[] array1,
short[] array2) |
static <T> T[] |
addAll(T[] array1,
T[] array2) |
static <T> Iterable<T> |
arrayAsIterable(Class<T> componentType,
Object array)
将数组转换成Iterable列表。
|
static byte[] |
booleanToByte(boolean[] values) |
static char[] |
booleanToChar(boolean[] values) |
static double[] |
booleanToDouble(boolean[] values) |
static float[] |
booleanToFloat(boolean[] values) |
static int[] |
booleanToInt(boolean[] values) |
static long[] |
booleanToLong(boolean[] values) |
static short[] |
booleanToShort(boolean[] values) |
static String[] |
booleanToString(boolean[] values) |
static boolean[] |
byteToBoolean(byte[] values) |
static char[] |
byteToChar(byte[] values) |
static double[] |
byteToDouble(byte[] values) |
static float[] |
byteToFloat(byte[] values) |
static int[] |
byteToInt(byte[] values) |
static long[] |
byteToLong(byte[] values) |
static short[] |
byteToShort(byte[] values) |
static String[] |
byteToString(byte[] values) |
static boolean[] |
charToBoolean(char[] values) |
static byte[] |
charToByte(char[] values) |
static double[] |
charToDouble(char[] values) |
static float[] |
charToFloat(char[] values) |
static int[] |
charToInt(char[] values) |
static long[] |
charToLong(char[] values) |
static short[] |
charToShort(char[] values) |
static String[] |
charToString(char[] values) |
static boolean[] |
clone(boolean[] array)
复制一个数组。
|
static byte[] |
clone(byte[] array)
复制一个数组。
|
static char[] |
clone(char[] array)
复制一个数组。
|
static double[] |
clone(double[] array)
复制一个数组。
|
static float[] |
clone(float[] array)
复制一个数组。
|
static int[] |
clone(int[] array)
复制一个数组。
|
static long[] |
clone(long[] array)
复制一个数组。
|
static short[] |
clone(short[] array)
复制一个数组。
|
static <T> T[] |
clone(T[] array)
复制一个数组。
|
static boolean |
contains(boolean[] array,
boolean booleanToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(boolean[] array,
boolean[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(byte[] array,
byte byteToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(byte[] array,
byte[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(char[] array,
char charToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(char[] array,
char[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(double[] array,
double doubleToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(double[] array,
double[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(double[] array,
double[] arrayToFind,
double tolerance)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(double[] array,
double doubleToFind,
double tolerance)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(float[] array,
float floatToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(float[] array,
float[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(float[] array,
float[] arrayToFind,
float tolerance)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(float[] array,
float floatToFind,
float tolerance)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(int[] array,
int intToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(int[] array,
int[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(long[] array,
long longToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(long[] array,
long[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(Object[] array,
Object objectToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(Object[] array,
Object[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static boolean |
contains(short[] array,
short shortToFind)
判断指定对象是否存在于指定数组中。
|
static boolean |
contains(short[] array,
short[] arrayToFind)
判断指定元素序列是否存在于指定数组中。
|
static <T> T[] |
create(int length,
Class<T> type) |
static <T,S extends T> |
defaultIfEmpty(T array,
S defaultValue)
如果数组是null或空数组[],则返回指定数组默认值。
|
static boolean[] |
doubleToBoolean(double[] values) |
static byte[] |
doubleToByte(double[] values) |
static char[] |
doubleToChar(double[] values) |
static float[] |
doubleToFloat(double[] values) |
static int[] |
doubleToInt(double[] values) |
static long[] |
doubleToLong(double[] values) |
static short[] |
doubleToShort(double[] values) |
static String[] |
doubleToString(double[] values) |
static boolean[] |
floatToBoolean(float[] values) |
static byte[] |
floatToByte(float[] values) |
static char[] |
floatToChar(float[] values) |
static double[] |
floatToDouble(float[] values) |
static int[] |
floatToInt(float[] values) |
static long[] |
floatToLong(float[] values) |
static short[] |
floatToShort(float[] values) |
static String[] |
floatToString(float[] values) |
static int |
getLength(Object array) |
static int |
indexOf(boolean[] array,
boolean booleanToFind)
在数组中查找一个元素。
|
static int |
indexOf(boolean[] array,
boolean[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(boolean[] array,
boolean[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(boolean[] array,
boolean booleanToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(byte[] array,
byte byteToFind)
在数组中查找一个元素。
|
static int |
indexOf(byte[] array,
byte[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(byte[] array,
byte[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(byte[] array,
byte byteToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(char[] array,
char charToFind)
在数组中查找一个元素。
|
static int |
indexOf(char[] array,
char[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(char[] array,
char[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(char[] array,
char charToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(double[] array,
double doubleToFind)
在数组中查找一个元素。
|
static int |
indexOf(double[] array,
double[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(double[] array,
double[] arrayToFind,
double tolerance)
在数组中查找一个元素序列。
|
static int |
indexOf(double[] array,
double[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(double[] array,
double[] arrayToFind,
int startIndex,
double tolerance)
在数组中查找一个元素序列。
|
static int |
indexOf(double[] array,
double doubleToFind,
double tolerance)
在数组中查找一个元素。
|
static int |
indexOf(double[] array,
double doubleToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(double[] array,
double doubleToFind,
int startIndex,
double tolerance)
在数组中查找一个元素。
|
static int |
indexOf(float[] array,
float floatToFind)
在数组中查找一个元素。
|
static int |
indexOf(float[] array,
float[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(float[] array,
float[] arrayToFind,
float tolerance)
在数组中查找一个元素序列。
|
static int |
indexOf(float[] array,
float[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(float[] array,
float[] arrayToFind,
int startIndex,
float tolerance)
在数组中查找一个元素序列。
|
static int |
indexOf(float[] array,
float floatToFind,
float tolerance)
在数组中查找一个元素。
|
static int |
indexOf(float[] array,
float floatToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(float[] array,
float floatToFind,
int startIndex,
float tolerance)
在数组中查找一个元素。
|
static int |
indexOf(int[] array,
int intToFind)
在数组中查找一个元素。
|
static int |
indexOf(int[] array,
int[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(int[] array,
int[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(int[] array,
int intToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(long[] array,
long longToFind)
在数组中查找一个元素。
|
static int |
indexOf(long[] array,
long[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(long[] array,
long[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(long[] array,
long longToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(Object[] array,
Object objectToFind)
在数组中查找一个元素。
|
static int |
indexOf(Object[] array,
Object[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(Object[] array,
Object[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(Object[] array,
Object objectToFind,
int startIndex)
在数组中查找一个元素。
|
static int |
indexOf(short[] array,
short shortToFind)
在数组中查找一个元素。
|
static int |
indexOf(short[] array,
short[] arrayToFind)
在数组中查找一个元素序列。
|
static int |
indexOf(short[] array,
short[] arrayToFind,
int startIndex)
在数组中查找一个元素序列。
|
static int |
indexOf(short[] array,
short shortToFind,
int startIndex)
在数组中查找一个元素。
|
static boolean[] |
intToBoolean(int[] values) |
static byte[] |
intToByte(int[] values) |
static char[] |
intToChar(int[] values) |
static double[] |
intToDouble(int[] values) |
static float[] |
intToFloat(int[] values) |
static long[] |
intToLong(int[] values) |
static short[] |
intToShort(int[] values) |
static String[] |
intToString(int[] values) |
static <T> boolean |
isCompatible(T[] arrayA,
T[] arrayB)
判断两个数组的相容性, 如果一个被另一个包含,即为相容
|
static boolean |
isEmpty(Object array)
检查数组是否为null或空数组[]。
|
static boolean |
isNotEmpty(Object array)
检查数组是否为null或空数组[]。
|
static boolean |
isSameLength(boolean[] array1,
boolean[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(byte[] array1,
byte[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(char[] array1,
char[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(double[] array1,
double[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(float[] array1,
float[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(int[] array1,
int[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(long[] array1,
long[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(Object[] array1,
Object[] array2)
判断两个数组是否具有相同的长度。
|
static boolean |
isSameLength(short[] array1,
short[] array2)
判断两个数组是否具有相同的长度。
|
static int |
lastIndexOf(boolean[] array,
boolean booleanToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(boolean[] array,
boolean[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(boolean[] array,
boolean[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(boolean[] array,
boolean booleanToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(byte[] array,
byte byteToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(byte[] array,
byte[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(byte[] array,
byte[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(byte[] array,
byte byteToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(char[] array,
char charToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(char[] array,
char[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(char[] array,
char[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(char[] array,
char charToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(double[] array,
double doubleToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(double[] array,
double[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(double[] array,
double[] arrayToFind,
double tolerance)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(double[] array,
double[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(double[] array,
double[] arrayToFind,
int startIndex,
double tolerance)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(double[] array,
double doubleToFind,
double tolerance)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(double[] array,
double doubleToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(double[] array,
double doubleToFind,
int startIndex,
double tolerance)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(float[] array,
float floatToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(float[] array,
float[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(float[] array,
float[] arrayToFind,
float tolerance)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(float[] array,
float[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(float[] array,
float[] arrayToFind,
int startIndex,
float tolerance)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(float[] array,
float floatToFind,
float tolerance)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(float[] array,
float floatToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(float[] array,
float floatToFind,
int startIndex,
float tolerance)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(int[] array,
int intToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(int[] array,
int[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(int[] array,
int[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(int[] array,
int intToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(long[] array,
long longToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(long[] array,
long[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(long[] array,
long[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(long[] array,
long longToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(Object[] array,
Object objectToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(Object[] array,
Object[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(Object[] array,
Object[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(Object[] array,
Object objectToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(short[] array,
short shortToFind)
在数组中从末尾开始查找一个元素。
|
static int |
lastIndexOf(short[] array,
short[] arrayToFind)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(short[] array,
short[] arrayToFind,
int startIndex)
在数组中从末尾开始查找一个元素序列。
|
static int |
lastIndexOf(short[] array,
short shortToFind,
int startIndex)
在数组中从末尾开始查找一个元素。
|
static int |
length(Object array)
取得数组的长度。
|
static boolean[] |
longToBoolean(long[] values) |
static byte[] |
longToByte(long[] values) |
static char[] |
longToChar(long[] values) |
static double[] |
longToDouble(long[] values) |
static float[] |
longToFloat(long[] values) |
static int[] |
longToInt(long[] values) |
static short[] |
longToShort(long[] values) |
static String[] |
longToString(long[] values) |
static boolean[] |
remove(boolean[] array,
int index) |
static boolean[] |
remove(boolean[] buffer,
int offset,
int length) |
static byte[] |
remove(byte[] array,
int index) |
static byte[] |
remove(byte[] buffer,
int offset,
int length) |
static char[] |
remove(char[] array,
int index) |
static char[] |
remove(char[] buffer,
int offset,
int length) |
static double[] |
remove(double[] array,
int index) |
static double[] |
remove(double[] buffer,
int offset,
int length) |
static float[] |
remove(float[] array,
int index) |
static float[] |
remove(float[] buffer,
int offset,
int length) |
static int[] |
remove(int[] array,
int index) |
static int[] |
remove(int[] buffer,
int offset,
int length) |
static long[] |
remove(long[] array,
int index) |
static long[] |
remove(long[] buffer,
int offset,
int length) |
static short[] |
remove(short[] array,
int index) |
static short[] |
remove(short[] buffer,
int offset,
int length) |
static String[] |
remove(String[] buffer,
int offset,
int length) |
static <T> T[] |
remove(T[] array,
int index) |
static <T> T[] |
remove(T[] buffer,
int offset,
int length) |
static <T> T[] |
remove(T[] buffer,
int offset,
int length,
Class<?> componentType) |
static boolean[] |
removeElement(boolean[] array,
boolean element) |
static byte[] |
removeElement(byte[] array,
byte element) |
static char[] |
removeElement(char[] array,
char element) |
static double[] |
removeElement(double[] array,
double element) |
static float[] |
removeElement(float[] array,
float element) |
static int[] |
removeElement(int[] array,
int element) |
static long[] |
removeElement(long[] array,
long element) |
static Object[] |
removeElement(Object[] array,
Object element) |
static short[] |
removeElement(short[] array,
short element) |
static boolean[] |
resize(boolean[] buffer,
int newSize) |
static byte[] |
resize(byte[] buffer,
int newSize) |
static char[] |
resize(char[] buffer,
int newSize) |
static double[] |
resize(double[] buffer,
int newSize) |
static float[] |
resize(float[] buffer,
int newSize) |
static int[] |
resize(int[] buffer,
int newSize) |
static long[] |
resize(long[] buffer,
int newSize) |
static short[] |
resize(short[] buffer,
int newSize) |
static String[] |
resize(String[] buffer,
int newSize) |
static <T> T[] |
resize(T[] buffer,
int newSize) |
static void |
reverse(boolean[] array)
反转数组的元素顺序。
|
static void |
reverse(byte[] array)
反转数组的元素顺序。
|
static void |
reverse(char[] array)
反转数组的元素顺序。
|
static void |
reverse(double[] array)
反转数组的元素顺序。
|
static void |
reverse(float[] array)
反转数组的元素顺序。
|
static void |
reverse(int[] array)
反转数组的元素顺序。
|
static void |
reverse(long[] array)
反转数组的元素顺序。
|
static void |
reverse(Object[] array)
反转数组的元素顺序。
|
static void |
reverse(short[] array)
反转数组的元素顺序。
|
static boolean[] |
shortToBoolean(short[] values) |
static byte[] |
shortToByte(short[] values) |
static char[] |
shortToChar(short[] values) |
static double[] |
shortToDouble(short[] values) |
static float[] |
shortToFloat(short[] values) |
static int[] |
shortToInt(short[] values) |
static long[] |
shortToLong(short[] values) |
static String[] |
shortToString(short[] values) |
static boolean[] |
subarray(boolean[] buffer,
int offset,
int length) |
static byte[] |
subarray(byte[] buffer,
int offset,
int length) |
static char[] |
subarray(char[] buffer,
int offset,
int length) |
static double[] |
subarray(double[] buffer,
int offset,
int length) |
static float[] |
subarray(float[] buffer,
int offset,
int length) |
static int[] |
subarray(int[] buffer,
int offset,
int length) |
static long[] |
subarray(long[] buffer,
int offset,
int length) |
static short[] |
subarray(short[] buffer,
int offset,
int length) |
static String[] |
subarray(String[] buffer,
int offset,
int length) |
static <T> T[] |
subarray(T[] buffer,
int offset,
int length) |
static <T> T[] |
subarray(T[] buffer,
int offset,
int length,
Class<T> componentType) |
static <K,V> Map<K,V> |
toMap(Object[][] keyValueArray,
Class<K> keyType,
Class<V> valueType)
将数组转换成Map。
|
static <K,V> Map<K,V> |
toMap(Object[][] keyValueArray,
Class<K> keyType,
Class<V> valueType,
Map<K,V> map)
将数组转换成Map。
|
static String |
toString(Object array)
将数组转换成易于阅读的字符串表示。
|
static String |
toString(Object array,
String nullArrayStr)
将数组转换成易于阅读的字符串表示。
|
static String |
toString(Object array,
String nullArrayStr,
String nullElementStr)
将数组转换成易于阅读的字符串表示。
|
static String[] |
toStringArray(boolean[] array) |
static String[] |
toStringArray(byte[] array) |
static String[] |
toStringArray(char[] array) |
static String[] |
toStringArray(double[] array) |
static String[] |
toStringArray(float[] array) |
static String[] |
toStringArray(int[] array) |
static String[] |
toStringArray(long[] array) |
static String[] |
toStringArray(Object value) |
static String[] |
toStringArray(Object[] array) |
static String[] |
toStringArray(short[] array) |
static String[] |
toStringArray(String[] array) |
public static int length(Object array)
此方法比Array.getLength()要快得多。
array - 要检查的数组public static boolean isEmpty(Object array)
ArrayUtil.isEmpty(null) = true ArrayUtil.isEmpty(new int[0]) = true ArrayUtil.isEmpty(new int[10]) = false
array - 要检查的数组public static boolean isNotEmpty(Object array)
ArrayUtil.isNotEmpty(null) = false ArrayUtil.isNotEmpty(new int[0]) = false ArrayUtil.isNotEmpty(new int[10]) = true
array - 要检查的数组public static <T,S extends T> T defaultIfEmpty(T array,
S defaultValue)
ArrayUtil.defaultIfEmpty(null, defaultArray) = defaultArray ArrayUtil.defaultIfEmpty(new String[0], defaultArray) = 数组本身 ArrayUtil.defaultIfEmpty(new String[10], defaultArray) = 数组本身
array - 要转换的数组defaultArray - 默认数组public static <T> Iterable<T> arrayAsIterable(Class<T> componentType, Object array)
如果输入数组为null,则视作空数组。
该方法返回的Iterable对象是轻量而高效的,不会产生复制数组的开销。你可以使用 CollectionUtil.createArrayList(asIterable(componentType, array))或 CollectionUtil.createLinkedList(asIterable(componentType, array)) 来进一步将 Iterable 转换成指定类型的 List对象。
componentType - Iterable元素的类型,必须和数组类型兼容。例如对于 int[] 数组, componentType
必须为 Integer.class。array - 要转换的数组public static <K,V> Map<K,V> toMap(Object[][] keyValueArray, Class<K> keyType, Class<V> valueType)
Map colorMap = ArrayUtil.toMap(new String[][] {{
{"RED", 0xFF0000},
{"GREEN", 0x00FF00},
{"BLUE", 0x0000FF}}, String.class, Integer.class);
keyValueArray - 要转换的数组keyType - key的类型,数组元素keyValueArray[n][0]的类型必须与之兼容valueType - value的类型,数组元素keyValueArray[n][1]的类型必须与之兼容public static <K,V> Map<K,V> toMap(Object[][] keyValueArray, Class<K> keyType, Class<V> valueType, Map<K,V> map)
Map colorMap = ArrayUtil.toMap(new String[][] {{
{"RED", 0xFF0000},
{"GREEN", 0x00FF00},
{"BLUE", 0x0000FF}}, String.class, Integer.class, map);
keyValueArray - 要转换的数组keyType - key的类型,数组元素keyValueArray[n][0]的类型必须与之兼容valueType - value的类型,数组元素keyValueArray[n][1]的类型必须与之兼容map - 要填充的map,如果为null则自动创建之public static boolean isSameLength(Object[] array1, Object[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(long[] array1,
long[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(int[] array1,
int[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(short[] array1,
short[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(byte[] array1,
byte[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(double[] array1,
double[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(float[] array1,
float[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(boolean[] array1,
boolean[] array2)
array1 - 数组1array2 - 数组2public static boolean isSameLength(char[] array1,
char[] array2)
array1 - 数组1array2 - 数组2public static void reverse(Object[] array)
array - 要反转的数组public static void reverse(long[] array)
array - 要反转的数组public static void reverse(int[] array)
array - 要反转的数组public static void reverse(short[] array)
array - 要反转的数组public static void reverse(byte[] array)
array - 要反转的数组public static void reverse(double[] array)
array - 要反转的数组public static void reverse(float[] array)
array - 要反转的数组public static void reverse(boolean[] array)
array - 要反转的数组public static void reverse(char[] array)
array - 要反转的数组public static int indexOf(Object[] array, Object objectToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组objectToFind - 要查找的元素public static int indexOf(Object[] array, Object[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(Object[] array, Object objectToFind, int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组objectToFind - 要查找的元素startIndex - 起始索引public static int indexOf(Object[] array, Object[] arrayToFind, int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(Object[] array, Object objectToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组objectToFind - 要查找的元素public static int lastIndexOf(Object[] array, Object[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(Object[] array, Object objectToFind, int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组objectToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(Object[] array, Object[] arrayToFind, int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(Object[] array, Object objectToFind)
如果数组为null则返回false。
array - 要扫描的数组objectToFind - 要查找的元素public static boolean contains(Object[] array, Object[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(long[] array,
long longToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组longToFind - 要查找的元素public static int indexOf(long[] array,
long[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(long[] array,
long longToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组longToFind - 要查找的元素startIndex - 起始索引public static int indexOf(long[] array,
long[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(long[] array,
long longToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组longToFind - 要查找的元素public static int lastIndexOf(long[] array,
long[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(long[] array,
long longToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组longToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(long[] array,
long[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(long[] array,
long longToFind)
如果数组为null则返回false。
array - 要扫描的数组longToFind - 要查找的元素public static boolean contains(long[] array,
long[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(int[] array,
int intToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组intToFind - 要查找的元素public static int indexOf(int[] array,
int[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(int[] array,
int intToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组intToFind - 要查找的元素startIndex - 起始索引public static int indexOf(int[] array,
int[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(int[] array,
int intToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组intToFind - 要查找的元素public static int lastIndexOf(int[] array,
int[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(int[] array,
int intToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组intToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(int[] array,
int[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(int[] array,
int intToFind)
如果数组为null则返回false。
array - 要扫描的数组intToFind - 要查找的元素public static boolean contains(int[] array,
int[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(short[] array,
short shortToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组shortToFind - 要查找的元素public static int indexOf(short[] array,
short[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(short[] array,
short shortToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组shortToFind - 要查找的元素startIndex - 起始索引public static int indexOf(short[] array,
short[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(short[] array,
short shortToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组shortToFind - 要查找的元素public static int lastIndexOf(short[] array,
short[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(short[] array,
short shortToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组shortToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(short[] array,
short[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(short[] array,
short shortToFind)
如果数组为null则返回false。
array - 要扫描的数组shortToFind - 要查找的元素public static boolean contains(short[] array,
short[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(byte[] array,
byte byteToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组byteToFind - 要查找的元素public static int indexOf(byte[] array,
byte[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(byte[] array,
byte byteToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组byteToFind - 要查找的元素startIndex - 起始索引public static int indexOf(byte[] array,
byte[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(byte[] array,
byte byteToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组byteToFind - 要查找的元素public static int lastIndexOf(byte[] array,
byte[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(byte[] array,
byte byteToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组byteToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(byte[] array,
byte[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(byte[] array,
byte byteToFind)
如果数组为null则返回false。
array - 要扫描的数组byteToFind - 要查找的元素public static boolean contains(byte[] array,
byte[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(double[] array,
double doubleToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组doubleToFind - 要查找的元素public static int indexOf(double[] array,
double doubleToFind,
double tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组doubleToFind - 要查找的元素tolerance - 误差public static int indexOf(double[] array,
double[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(double[] array,
double[] arrayToFind,
double tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列tolerance - 误差public static int indexOf(double[] array,
double doubleToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组doubleToFind - 要查找的元素startIndex - 起始索引public static int indexOf(double[] array,
double doubleToFind,
int startIndex,
double tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组doubleToFind - 要查找的元素startIndex - 起始索引tolerance - 误差public static int indexOf(double[] array,
double[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int indexOf(double[] array,
double[] arrayToFind,
int startIndex,
double tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引tolerance - 误差public static int lastIndexOf(double[] array,
double doubleToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组doubleToFind - 要查找的元素public static int lastIndexOf(double[] array,
double doubleToFind,
double tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组doubleToFind - 要查找的元素tolerance - 误差public static int lastIndexOf(double[] array,
double[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(double[] array,
double[] arrayToFind,
double tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列tolerance - 误差public static int lastIndexOf(double[] array,
double doubleToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组doubleToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(double[] array,
double doubleToFind,
int startIndex,
double tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组doubleToFind - 要查找的元素startIndex - 起始索引tolerance - 误差public static int lastIndexOf(double[] array,
double[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(double[] array,
double[] arrayToFind,
int startIndex,
double tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引tolerance - 误差public static boolean contains(double[] array,
double doubleToFind)
如果数组为null则返回false。
array - 要扫描的数组doubleToFind - 要查找的元素public static boolean contains(double[] array,
double doubleToFind,
double tolerance)
如果数组为null则返回false。
array - 要扫描的数组doubleToFind - 要查找的元素tolerance - 误差public static boolean contains(double[] array,
double[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static boolean contains(double[] array,
double[] arrayToFind,
double tolerance)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列tolerance - 误差public static int indexOf(float[] array,
float floatToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组floatToFind - 要查找的元素public static int indexOf(float[] array,
float floatToFind,
float tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组floatToFind - 要查找的元素tolerance - 误差public static int indexOf(float[] array,
float[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(float[] array,
float[] arrayToFind,
float tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列tolerance - 误差public static int indexOf(float[] array,
float floatToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组floatToFind - 要查找的元素startIndex - 起始索引public static int indexOf(float[] array,
float floatToFind,
int startIndex,
float tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组floatToFind - 要查找的元素startIndex - 起始索引tolerance - 误差public static int indexOf(float[] array,
float[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int indexOf(float[] array,
float[] arrayToFind,
int startIndex,
float tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引tolerance - 误差public static int lastIndexOf(float[] array,
float floatToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组floatToFind - 要查找的元素public static int lastIndexOf(float[] array,
float floatToFind,
float tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组floatToFind - 要查找的元素tolerance - 误差public static int lastIndexOf(float[] array,
float[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(float[] array,
float[] arrayToFind,
float tolerance)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列tolerance - 误差public static int lastIndexOf(float[] array,
float floatToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组floatToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(float[] array,
float floatToFind,
int startIndex,
float tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组floatToFind - 要查找的元素startIndex - 起始索引tolerance - 误差public static int lastIndexOf(float[] array,
float[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(float[] array,
float[] arrayToFind,
int startIndex,
float tolerance)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引tolerance - 误差public static boolean contains(float[] array,
float floatToFind)
如果数组为null则返回false。
array - 要扫描的数组floatToFind - 要查找的元素public static boolean contains(float[] array,
float floatToFind,
float tolerance)
如果数组为null则返回false。
array - 要扫描的数组floatToFind - 要查找的元素tolerance - 误差public static boolean contains(float[] array,
float[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static boolean contains(float[] array,
float[] arrayToFind,
float tolerance)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列tolerance - 误差public static int indexOf(boolean[] array,
boolean booleanToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组booleanToFind - 要查找的元素public static int indexOf(boolean[] array,
boolean[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(boolean[] array,
boolean booleanToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组booleanToFind - 要查找的元素startIndex - 起始索引public static int indexOf(boolean[] array,
boolean[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(boolean[] array,
boolean booleanToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组booleanToFind - 要查找的元素public static int lastIndexOf(boolean[] array,
boolean[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(boolean[] array,
boolean booleanToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组booleanToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(boolean[] array,
boolean[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(boolean[] array,
boolean booleanToFind)
如果数组为null则返回false。
array - 要扫描的数组booleanToFind - 要查找的元素public static boolean contains(boolean[] array,
boolean[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(char[] array,
char charToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组charToFind - 要查找的元素public static int indexOf(char[] array,
char[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int indexOf(char[] array,
char charToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组charToFind - 要查找的元素startIndex - 起始索引public static int indexOf(char[] array,
char[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则看作0,超出数组长度的起始索引则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static int lastIndexOf(char[] array,
char charToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组charToFind - 要查找的元素public static int lastIndexOf(char[] array,
char[] arrayToFind)
如果未找到或数组为null则返回-1。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static int lastIndexOf(char[] array,
char charToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组charToFind - 要查找的元素startIndex - 起始索引public static int lastIndexOf(char[] array,
char[] arrayToFind,
int startIndex)
如果未找到或数组为null则返回-1。
起始索引小于0则返回-1,超出数组长度的起始索引则从数组末尾开始找。
array - 要扫描的数组arrayToFind - 要查找的元素序列startIndex - 起始索引public static boolean contains(char[] array,
char charToFind)
如果数组为null则返回false。
array - 要扫描的数组charToFind - 要查找的元素public static boolean contains(char[] array,
char[] arrayToFind)
如果数组为null则返回false。
array - 要扫描的数组arrayToFind - 要查找的元素序列public static <T> T[] clone(T[] array)
此方法只进行“浅复制”,也就是说,数组中的对象本身不会被复制。 另外,此方法也不处理多维数组。
array - 要复制的数组public static long[] clone(long[] array)
此方法也不处理多维数组。
array - 要复制的数组public static int[] clone(int[] array)
此方法也不处理多维数组。
array - 要复制的数组public static short[] clone(short[] array)
此方法也不处理多维数组。
array - 要复制的数组public static byte[] clone(byte[] array)
此方法也不处理多维数组。
array - 要复制的数组public static double[] clone(double[] array)
此方法也不处理多维数组。
array - 要复制的数组public static float[] clone(float[] array)
此方法也不处理多维数组。
array - 要复制的数组public static boolean[] clone(boolean[] array)
此方法也不处理多维数组。
array - 要复制的数组public static char[] clone(char[] array)
此方法也不处理多维数组。
array - 要复制的数组public static <T> T[] addAll(T[] array1,
T[] array2)
public static boolean[] addAll(boolean[] array1,
boolean[] array2)
public static char[] addAll(char[] array1,
char[] array2)
public static byte[] addAll(byte[] array1,
byte[] array2)
public static short[] addAll(short[] array1,
short[] array2)
public static int[] addAll(int[] array1,
int[] array2)
public static long[] addAll(long[] array1,
long[] array2)
public static float[] addAll(float[] array1,
float[] array2)
public static double[] addAll(double[] array1,
double[] array2)
public static String toString(Object array)
如果数组是null则返回[],支持多维数组。 如果数组元素为null ,则显示<null>。
ArrayUtil.toString(null) = "[]"
ArrayUtil.toString(new int[] {1, 2, 3}) = "[1, 2, 3]"
ArrayUtil.toString(new boolean[] {true, false, true}) = "[true, false, true]"
ArrayUtil.toString(new Object[] {
{1, 2, 3}, // 嵌套数组
hello, // 嵌套非数组
null, // 嵌套null
{}, // 嵌套空数组
{2, 3, 4} // 嵌套数组
}) = "[[1, 2, 3], hello, <null>, [], [2, 3, 4]]"
array - 要转换的数组public static String toString(Object array, String nullArrayStr)
如果数组是null则返回指定字符串,支持多维数组。 如果数组元素为null,则显示 <null>。
ArrayUtil.toString(null, "null") = "null"
ArrayUtil.toString(new int[] {1, 2, 3}, "null") = "[1, 2, 3]"
ArrayUtil.toString(new boolean[] {true, false, true}, "null") = "[true, false, true]"
ArrayUtil.toString(new Object[] {
{1, 2, 3}, // 嵌套数组
hello, // 嵌套非数组
null, // 嵌套null
{}, // 嵌套空数组
{2, 3, 4} // 嵌套数组
}, "null") = "[[1, 2, 3], hello, <null>, [], [2, 3, 4]]"
array - 要转换的数组nullArrayStr - 如果数组是null,则返回此字符串public static String toString(Object array, String nullArrayStr, String nullElementStr)
如果数组是null则返回指定字符串,支持多维数组。 如果数组元素为null,则显示指定字符串。
ArrayUtil.toString(null, "null", "NULL") = "null"
ArrayUtil.toString(new int[] {1, 2, 3}, "null", "NULL") = "[1, 2, 3]"
ArrayUtil.toString(new boolean[] {true, false, true}, "null", "NULL") = "[true, false, true]"
ArrayUtil.toString(new Object[] {
{1, 2, 3}, // 嵌套数组
hello, // 嵌套非数组
null, // 嵌套null
{}, // 嵌套空数组
{2, 3, 4} // 嵌套数组
}, "null", "NULL") = "[[1, 2, 3], hello, NULL, [], [2, 3, 4]]"
array - 要转换的数组nullArrayStr - 如果数组是null,则返回此字符串nullElementStr - 如果数组中的元素为null,则返回此字符串public static <T> boolean isCompatible(T[] arrayA,
T[] arrayB)
T - arrayA - 数组AarrayB - 数组Bpublic static <T> T[] resize(T[] buffer,
int newSize)
public static byte[] resize(byte[] buffer,
int newSize)
public static char[] resize(char[] buffer,
int newSize)
public static short[] resize(short[] buffer,
int newSize)
public static int[] resize(int[] buffer,
int newSize)
public static long[] resize(long[] buffer,
int newSize)
public static float[] resize(float[] buffer,
int newSize)
public static double[] resize(double[] buffer,
int newSize)
public static boolean[] resize(boolean[] buffer,
int newSize)
public static String[] toStringArray(byte[] array)
public static String[] toStringArray(char[] array)
public static String[] toStringArray(short[] array)
public static String[] toStringArray(int[] array)
public static String[] toStringArray(long[] array)
public static String[] toStringArray(float[] array)
public static String[] toStringArray(double[] array)
public static String[] toStringArray(boolean[] array)
public static boolean[] charToBoolean(char[] values)
public static boolean[] intToBoolean(int[] values)
public static boolean[] longToBoolean(long[] values)
public static boolean[] doubleToBoolean(double[] values)
public static boolean[] floatToBoolean(float[] values)
public static boolean[] byteToBoolean(byte[] values)
public static boolean[] shortToBoolean(short[] values)
public static byte[] charToByte(char[] values)
public static byte[] intToByte(int[] values)
public static byte[] longToByte(long[] values)
public static byte[] doubleToByte(double[] values)
public static byte[] floatToByte(float[] values)
public static byte[] shortToByte(short[] values)
public static byte[] booleanToByte(boolean[] values)
public static char[] intToChar(int[] values)
public static char[] longToChar(long[] values)
public static char[] doubleToChar(double[] values)
public static char[] floatToChar(float[] values)
public static char[] shortToChar(short[] values)
public static char[] booleanToChar(boolean[] values)
public static char[] byteToChar(byte[] values)
public static double[] intToDouble(int[] values)
public static double[] longToDouble(long[] values)
public static double[] charToDouble(char[] values)
public static double[] floatToDouble(float[] values)
public static double[] shortToDouble(short[] values)
public static double[] booleanToDouble(boolean[] values)
public static double[] byteToDouble(byte[] values)
public static float[] intToFloat(int[] values)
public static float[] longToFloat(long[] values)
public static float[] charToFloat(char[] values)
public static float[] doubleToFloat(double[] values)
public static float[] shortToFloat(short[] values)
public static float[] booleanToFloat(boolean[] values)
public static float[] byteToFloat(byte[] values)
public static int[] floatToInt(float[] values)
public static int[] longToInt(long[] values)
public static int[] charToInt(char[] values)
public static int[] doubleToInt(double[] values)
public static int[] shortToInt(short[] values)
public static int[] booleanToInt(boolean[] values)
public static int[] byteToInt(byte[] values)
public static long[] floatToLong(float[] values)
public static long[] intToLong(int[] values)
public static long[] charToLong(char[] values)
public static long[] doubleToLong(double[] values)
public static long[] shortToLong(short[] values)
public static long[] booleanToLong(boolean[] values)
public static long[] byteToLong(byte[] values)
public static short[] floatToShort(float[] values)
public static short[] intToShort(int[] values)
public static short[] charToShort(char[] values)
public static short[] doubleToShort(double[] values)
public static short[] longToShort(long[] values)
public static short[] booleanToShort(boolean[] values)
public static short[] byteToShort(byte[] values)
public static String[] floatToString(float[] values)
public static String[] intToString(int[] values)
public static String[] charToString(char[] values)
public static String[] doubleToString(double[] values)
public static String[] longToString(long[] values)
public static String[] booleanToString(boolean[] values)
public static String[] byteToString(byte[] values)
public static String[] shortToString(short[] values)
public static <T> T[] create(int length,
Class<T> type)
public static <T> T[] subarray(T[] buffer,
int offset,
int length)
public static <T> T[] subarray(T[] buffer,
int offset,
int length,
Class<T> componentType)
public static byte[] subarray(byte[] buffer,
int offset,
int length)
public static char[] subarray(char[] buffer,
int offset,
int length)
public static short[] subarray(short[] buffer,
int offset,
int length)
public static int[] subarray(int[] buffer,
int offset,
int length)
public static long[] subarray(long[] buffer,
int offset,
int length)
public static float[] subarray(float[] buffer,
int offset,
int length)
public static double[] subarray(double[] buffer,
int offset,
int length)
public static boolean[] subarray(boolean[] buffer,
int offset,
int length)
public static <T> T[] remove(T[] array,
int index)
public static boolean[] remove(boolean[] array,
int index)
public static boolean[] removeElement(boolean[] array,
boolean element)
public static byte[] remove(byte[] array,
int index)
public static byte[] removeElement(byte[] array,
byte element)
public static char[] remove(char[] array,
int index)
public static char[] removeElement(char[] array,
char element)
public static double[] remove(double[] array,
int index)
public static double[] removeElement(double[] array,
double element)
public static float[] remove(float[] array,
int index)
public static float[] removeElement(float[] array,
float element)
public static int[] remove(int[] array,
int index)
public static int[] removeElement(int[] array,
int element)
public static long[] remove(long[] array,
int index)
public static long[] removeElement(long[] array,
long element)
public static short[] remove(short[] array,
int index)
public static short[] removeElement(short[] array,
short element)
public static <T> T[] remove(T[] buffer,
int offset,
int length)
public static <T> T[] remove(T[] buffer,
int offset,
int length,
Class<?> componentType)
public static byte[] remove(byte[] buffer,
int offset,
int length)
public static char[] remove(char[] buffer,
int offset,
int length)
public static short[] remove(short[] buffer,
int offset,
int length)
public static int[] remove(int[] buffer,
int offset,
int length)
public static long[] remove(long[] buffer,
int offset,
int length)
public static float[] remove(float[] buffer,
int offset,
int length)
public static double[] remove(double[] buffer,
int offset,
int length)
public static boolean[] remove(boolean[] buffer,
int offset,
int length)
public static int getLength(Object array)
Copyright © 2015. All rights reserved.