public class ArrayUtils extends Object
Modifier and Type | Field and Description |
---|---|
static boolean[] |
EMPTY_BOOLEAN_ARRAY |
static Boolean[] |
EMPTY_BOOLEAN_OBJECT_ARRAY |
static byte[] |
EMPTY_BYTE_ARRAY |
static Byte[] |
EMPTY_BYTE_OBJECT_ARRAY |
static char[] |
EMPTY_CHAR_ARRAY |
static Character[] |
EMPTY_CHARACTER_OBJECT_ARRAY |
static Class<?>[] |
EMPTY_CLASS_ARRAY |
static Date[] |
EMPTY_DATE_ARRAY |
static double[] |
EMPTY_DOUBLE_ARRAY |
static Double[] |
EMPTY_DOUBLE_OBJECT_ARRAY |
static File[] |
EMPTY_FILE_ARRAY |
static float[] |
EMPTY_FLOAT_ARRAY |
static Float[] |
EMPTY_FLOAT_OBJECT_ARRAY |
static int[] |
EMPTY_INT_ARRAY |
static Integer[] |
EMPTY_INTEGER_OBJECT_ARRAY |
static long[] |
EMPTY_LONG_ARRAY |
static Long[] |
EMPTY_LONG_OBJECT_ARRAY |
static Object[] |
EMPTY_OBJECT_ARRAY |
static short[] |
EMPTY_SHORT_ARRAY |
static Short[] |
EMPTY_SHORT_OBJECT_ARRAY |
static Date[] |
EMPTY_SQL_DATE_ARRAY |
static Time[] |
EMPTY_SQL_TIME_ARRAY |
static Timestamp[] |
EMPTY_SQL_TIMESTAMP_ARRAY |
static String[] |
EMPTY_STRING_ARRAY |
static URL[] |
EMPTY_URL_ARRAY |
static int |
INDEX_NOT_FOUND |
Constructor and Description |
---|
ArrayUtils() |
Modifier and Type | Method and Description |
---|---|
static <S,T> T[] |
cast(S[] from,
Class<T> to)
将一个子类的数组转换为父类的数组
|
static boolean |
contains(boolean[] array,
boolean valueToFind) |
static boolean |
contains(byte[] array,
byte valueToFind) |
static boolean |
contains(char[] array,
char valueToFind) |
static boolean |
contains(double[] array,
double valueToFind) |
static boolean |
contains(double[] array,
double valueToFind,
double tolerance) |
static boolean |
contains(float[] array,
float valueToFind) |
static boolean |
contains(int[] array,
int valueToFind) |
static boolean |
contains(long[] array,
long valueToFind) |
static boolean |
contains(Object[] array,
Object objectToFind) |
static boolean |
contains(short[] array,
short valueToFind) |
static boolean |
equals(Object[] a1,
Object[] a2)
两个对象数组的比较
|
static <T> List<T> |
filter(T[] source,
Predicate<T> filter)
进行数组元素过滤
|
static int |
indexOf(boolean[] array,
boolean valueToFind) |
static int |
indexOf(boolean[] array,
boolean valueToFind,
int startIndex) |
static int |
indexOf(byte[] array,
byte valueToFind) |
static int |
indexOf(byte[] array,
byte valueToFind,
int startIndex) |
static int |
indexOf(char[] array,
char valueToFind) |
static int |
indexOf(char[] array,
char valueToFind,
int startIndex) |
static int |
indexOf(double[] array,
double valueToFind) |
static int |
indexOf(double[] array,
double valueToFind,
double tolerance) |
static int |
indexOf(double[] array,
double valueToFind,
int startIndex) |
static int |
indexOf(double[] array,
double valueToFind,
int startIndex,
double tolerance) |
static int |
indexOf(float[] array,
float valueToFind) |
static int |
indexOf(float[] array,
float valueToFind,
int startIndex) |
static int |
indexOf(int[] array,
int valueToFind) |
static int |
indexOf(int[] array,
int valueToFind,
int startIndex) |
static int |
indexOf(long[] array,
long valueToFind) |
static int |
indexOf(long[] array,
long valueToFind,
int startIndex) |
static int |
indexOf(Object[] array,
Object objectToFind) |
static int |
indexOf(Object[] array,
Object objectToFind,
int startIndex) |
static int |
indexOf(short[] array,
short valueToFind) |
static int |
indexOf(short[] array,
short valueToFind,
int startIndex) |
static <T> boolean |
isEmpty(T[] array) |
static <T> boolean |
isNotEmpty(T[] array) |
static int |
lastIndexOf(boolean[] array,
boolean valueToFind) |
static int |
lastIndexOf(boolean[] array,
boolean valueToFind,
int startIndex) |
static int |
lastIndexOf(byte[] array,
byte valueToFind) |
static int |
lastIndexOf(byte[] array,
byte valueToFind,
int startIndex) |
static int |
lastIndexOf(char[] array,
char valueToFind) |
static int |
lastIndexOf(char[] array,
char valueToFind,
int startIndex) |
static int |
lastIndexOf(double[] array,
double valueToFind) |
static int |
lastIndexOf(double[] array,
double valueToFind,
double tolerance) |
static int |
lastIndexOf(double[] array,
double valueToFind,
int startIndex) |
static int |
lastIndexOf(double[] array,
double valueToFind,
int startIndex,
double tolerance) |
static int |
lastIndexOf(float[] array,
float valueToFind) |
static int |
lastIndexOf(float[] array,
float valueToFind,
int startIndex) |
static int |
lastIndexOf(int[] array,
int valueToFind) |
static int |
lastIndexOf(int[] array,
int valueToFind,
int startIndex) |
static int |
lastIndexOf(long[] array,
long valueToFind) |
static int |
lastIndexOf(long[] array,
long valueToFind,
int startIndex) |
static int |
lastIndexOf(Object[] array,
Object objectToFind) |
static int |
lastIndexOf(Object[] array,
Object objectToFind,
int startIndex) |
static int |
lastIndexOf(short[] array,
short valueToFind) |
static int |
lastIndexOf(short[] array,
short valueToFind,
int startIndex) |
static Object[] |
objectToArray(Object obj)
Object的数组转换为Object[]数组.
|
static <T> T[] |
removeNull(T[] arr1)
从数组中移除null的元素
|
static <T> T[] |
toArray(Enumeration<T> e,
Class<T> type) |
static <T> T[] |
toArray(List<T> items) |
static <T> T[] |
toArray(List<T> items,
Class<T> clz)
强制拷贝,根据传入的类转换
|
static Iterable<Character> |
toIterable(CharSequence e)
将CharSequence变为可遍历的char对象
这样就可以对CharBuffer,StringBuilder,Stringbuffer等对象进行Iterator模式的遍历了。
|
static Boolean[] |
toObject(boolean[] array) |
static Byte[] |
toObject(byte[] array) |
static Character[] |
toObject(char[] array) |
static Double[] |
toObject(double[] array) |
static Float[] |
toObject(float[] array) |
static Integer[] |
toObject(int[] array) |
static Long[] |
toObject(long[] array) |
static Short[] |
toObject(short[] array) |
static boolean[] |
toPrimitive(Boolean[] array) |
static boolean[] |
toPrimitive(Boolean[] array,
boolean valueForNull) |
static byte[] |
toPrimitive(Byte[] array) |
static byte[] |
toPrimitive(Byte[] array,
byte valueForNull) |
static char[] |
toPrimitive(Character[] array) |
static char[] |
toPrimitive(Character[] array,
char valueForNull) |
static double[] |
toPrimitive(Double[] array) |
static double[] |
toPrimitive(Double[] array,
double valueForNull) |
static float[] |
toPrimitive(Float[] array) |
static float[] |
toPrimitive(Float[] array,
float valueForNull) |
static int[] |
toPrimitive(Integer[] array) |
static int[] |
toPrimitive(Integer[] array,
int valueForNull) |
static long[] |
toPrimitive(Long[] array) |
static long[] |
toPrimitive(Long[] array,
long valueForNull) |
static short[] |
toPrimitive(Short[] array) |
static short[] |
toPrimitive(Short[] array,
short valueForNull) |
static String |
toString(Object array) |
public static final boolean[] EMPTY_BOOLEAN_ARRAY
public static final char[] EMPTY_CHAR_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
public static final short[] EMPTY_SHORT_ARRAY
public static final int[] EMPTY_INT_ARRAY
public static final long[] EMPTY_LONG_ARRAY
public static final float[] EMPTY_FLOAT_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAY
public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY
public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY
public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY
public static final Short[] EMPTY_SHORT_OBJECT_ARRAY
public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY
public static final Long[] EMPTY_LONG_OBJECT_ARRAY
public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY
public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
public static final String[] EMPTY_STRING_ARRAY
public static final Class<?>[] EMPTY_CLASS_ARRAY
public static final Date[] EMPTY_DATE_ARRAY
public static final Date[] EMPTY_SQL_DATE_ARRAY
public static final Time[] EMPTY_SQL_TIME_ARRAY
public static final Timestamp[] EMPTY_SQL_TIMESTAMP_ARRAY
public static final File[] EMPTY_FILE_ARRAY
public static final URL[] EMPTY_URL_ARRAY
public static final int INDEX_NOT_FOUND
public static Object[] objectToArray(Object obj)
obj
- public static <T> T[] toArray(List<T> items)
public static <T> T[] toArray(List<T> items, Class<T> clz)
T
- items
- clz
- public static <T> T[] toArray(Enumeration<T> e, Class<T> type)
public static <S,T> T[] cast(S[] from, Class<T> to)
from
- to
- public static <T> T[] removeNull(T[] arr1)
T
- arr1
- public static Iterable<Character> toIterable(CharSequence e)
e
- public static <T> List<T> filter(T[] source, Predicate<T> filter)
source
- filter
- public static boolean contains(boolean[] array, boolean valueToFind)
public static boolean contains(byte[] array, byte valueToFind)
public static boolean contains(char[] array, char valueToFind)
public static boolean contains(double[] array, double valueToFind)
public static boolean contains(double[] array, double valueToFind, double tolerance)
public static boolean contains(float[] array, float valueToFind)
public static boolean contains(int[] array, int valueToFind)
public static boolean contains(long[] array, long valueToFind)
public static boolean contains(short[] array, short valueToFind)
public static int indexOf(boolean[] array, boolean valueToFind)
public static int indexOf(boolean[] array, boolean valueToFind, int startIndex)
public static int indexOf(byte[] array, byte valueToFind)
public static int indexOf(byte[] array, byte valueToFind, int startIndex)
public static int indexOf(char[] array, char valueToFind)
public static int indexOf(char[] array, char valueToFind, int startIndex)
public static int indexOf(double[] array, double valueToFind)
public static int indexOf(double[] array, double valueToFind, double tolerance)
public static int indexOf(double[] array, double valueToFind, int startIndex)
public static int indexOf(double[] array, double valueToFind, int startIndex, double tolerance)
public static int indexOf(float[] array, float valueToFind)
public static int indexOf(float[] array, float valueToFind, int startIndex)
public static int indexOf(int[] array, int valueToFind)
public static int indexOf(int[] array, int valueToFind, int startIndex)
public static int indexOf(long[] array, long valueToFind)
public static int indexOf(long[] array, long valueToFind, int startIndex)
public static int indexOf(short[] array, short valueToFind)
public static int indexOf(short[] array, short valueToFind, int startIndex)
public static int lastIndexOf(boolean[] array, boolean valueToFind)
public static int lastIndexOf(boolean[] array, boolean valueToFind, int startIndex)
public static int lastIndexOf(byte[] array, byte valueToFind)
public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex)
public static int lastIndexOf(char[] array, char valueToFind)
public static int lastIndexOf(char[] array, char valueToFind, int startIndex)
public static int lastIndexOf(double[] array, double valueToFind)
public static int lastIndexOf(double[] array, double valueToFind, double tolerance)
public static int lastIndexOf(double[] array, double valueToFind, int startIndex)
public static int lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance)
public static int lastIndexOf(float[] array, float valueToFind)
public static int lastIndexOf(float[] array, float valueToFind, int startIndex)
public static int lastIndexOf(int[] array, int valueToFind)
public static int lastIndexOf(int[] array, int valueToFind, int startIndex)
public static int lastIndexOf(long[] array, long valueToFind)
public static int lastIndexOf(long[] array, long valueToFind, int startIndex)
public static int lastIndexOf(short[] array, short valueToFind)
public static int lastIndexOf(short[] array, short valueToFind, int startIndex)
public static Boolean[] toObject(boolean[] array)
public static Byte[] toObject(byte[] array)
public static Character[] toObject(char[] array)
public static Double[] toObject(double[] array)
public static Float[] toObject(float[] array)
public static Integer[] toObject(int[] array)
public static Long[] toObject(long[] array)
public static Short[] toObject(short[] array)
public static boolean[] toPrimitive(Boolean[] array)
public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull)
public static byte[] toPrimitive(Byte[] array)
public static byte[] toPrimitive(Byte[] array, byte valueForNull)
public static char[] toPrimitive(Character[] array)
public static char[] toPrimitive(Character[] array, char valueForNull)
public static double[] toPrimitive(Double[] array)
public static double[] toPrimitive(Double[] array, double valueForNull)
public static float[] toPrimitive(Float[] array)
public static float[] toPrimitive(Float[] array, float valueForNull)
public static int[] toPrimitive(Integer[] array)
public static int[] toPrimitive(Integer[] array, int valueForNull)
public static long[] toPrimitive(Long[] array)
public static long[] toPrimitive(Long[] array, long valueForNull)
public static short[] toPrimitive(Short[] array)
public static short[] toPrimitive(Short[] array, short valueForNull)
public static <T> boolean isNotEmpty(T[] array)
public static <T> boolean isEmpty(T[] array)
Copyright © 2020. All rights reserved.