public class Arrays1 extends Object
需要注意: 可变参数 Object... Object[] T... T[] 不应该传基本类型的数组, 应该传基本类型的包装类 基本类型数组无法转化为包装类型的数组, 从而入参为转化Object, 导致与预期结果不相同
Modifier and Type | Method and Description |
---|---|
static boolean[] |
arraycopy(boolean[] src,
int srcPos,
boolean[] dest,
int destPos,
int length) |
static byte[] |
arraycopy(byte[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
数组拷贝 自动扩容2倍
|
static char[] |
arraycopy(char[] src,
int srcPos,
char[] dest,
int destPos,
int length) |
static double[] |
arraycopy(double[] src,
int srcPos,
double[] dest,
int destPos,
int length) |
static float[] |
arraycopy(float[] src,
int srcPos,
float[] dest,
int destPos,
int length) |
static int[] |
arraycopy(int[] src,
int srcPos,
int[] dest,
int destPos,
int length) |
static long[] |
arraycopy(long[] src,
int srcPos,
long[] dest,
int destPos,
int length) |
static Object[] |
arraycopy(Object[] src,
int srcPos,
Object[] dest,
int destPos,
int length) |
static short[] |
arraycopy(short[] src,
int srcPos,
short[] dest,
int destPos,
int length) |
static <T> T[] |
arraycopys(T[] src,
int srcPos,
T[] dest,
int destPos,
int length,
IntFunction<T[]> generator) |
static boolean |
arrayEquals(Object o1,
Object o2)
判断数组是否相等
|
static Object[] |
compact(Object[] arr)
去除数组中的 null
|
static <T> T[] |
compacts(T[] arr,
IntFunction<T[]> generator) |
static boolean |
contains(boolean[] arr,
boolean s) |
static boolean |
contains(byte[] arr,
byte s)
判断数组是否包含某个元素
|
static boolean |
contains(char[] arr,
char s) |
static boolean |
contains(double[] arr,
double s) |
static boolean |
contains(float[] arr,
float s) |
static boolean |
contains(int[] arr,
int s) |
static boolean |
contains(long[] arr,
long s) |
static boolean |
contains(short[] arr,
short s) |
static <T> boolean |
contains(T[] arr,
T s) |
static int |
count(boolean target,
boolean... arr) |
static int |
count(byte target,
byte... arr) |
static int |
count(char target,
char... arr) |
static int |
count(double target,
double... arr) |
static int |
count(float target,
float... arr) |
static int |
count(int target,
int... arr) |
static int |
count(long target,
long... arr) |
static int |
count(short target,
short... arr) |
static <T> int |
count(T target,
T... arr)
查询目标元素在数组中出现的次数
|
static boolean[] |
def(boolean[] arr,
boolean[] def) |
static boolean[] |
def(boolean[] arr,
Supplier<boolean[]> def) |
static byte[] |
def(byte[] arr,
byte[] def) |
static byte[] |
def(byte[] arr,
Supplier<byte[]> def) |
static char[] |
def(char[] arr,
char[] def) |
static char[] |
def(char[] arr,
Supplier<char[]> def) |
static double[] |
def(double[] arr,
double[] def) |
static double[] |
def(double[] arr,
Supplier<double[]> def) |
static float[] |
def(float[] arr,
float[] def) |
static float[] |
def(float[] arr,
Supplier<float[]> def) |
static int[] |
def(int[] arr,
int[] def) |
static int[] |
def(int[] arr,
Supplier<int[]> def) |
static long[] |
def(long[] arr,
long[] def) |
static long[] |
def(long[] arr,
Supplier<long[]> def) |
static short[] |
def(short[] arr,
short[] def) |
static short[] |
def(short[] arr,
Supplier<short[]> def) |
static <T> T[] |
def(T[] arr,
Supplier<T[]> def) |
static <T> T[] |
def(T[] arr,
T[] def)
如果数组为空返回默认数组
|
static boolean[] |
exclude(boolean[] arr,
boolean... es) |
static byte[] |
exclude(byte[] arr,
byte... es)
排除数组中指定的值
|
static char[] |
exclude(char[] arr,
char... es) |
static double[] |
exclude(double[] arr,
double... es) |
static float[] |
exclude(float[] arr,
float... es) |
static int[] |
exclude(int[] arr,
int... es) |
static long[] |
exclude(long[] arr,
long... es) |
static Object[] |
exclude(Object[] arr,
Object... es)
排除数组中指定的值
|
static short[] |
exclude(short[] arr,
short... es) |
static <T> T[] |
excludes(T[] arr,
IntFunction<T[]> generator,
T... es) |
static <T> T[] |
excludes(T[] arr,
Predicate<T> p,
IntFunction<T[]> generator) |
static boolean |
first(boolean[] arr) |
static boolean |
first(boolean[] arr,
boolean def) |
static byte |
first(byte[] arr) |
static byte |
first(byte[] arr,
byte def) |
static char |
first(char[] arr) |
static char |
first(char[] arr,
char def) |
static double |
first(double[] arr) |
static double |
first(double[] arr,
double def) |
static float |
first(float[] arr) |
static float |
first(float[] arr,
float def) |
static int |
first(int[] arr) |
static int |
first(int[] arr,
int def) |
static long |
first(long[] arr) |
static long |
first(long[] arr,
long def) |
static short |
first(short[] array) |
static short |
first(short[] arr,
short def) |
static <T> T |
first(T[] arr)
获取数组第一个元素
|
static <T> T |
first(T[] arr,
T def)
获取数组第一个元素
|
static void |
forEach(Consumer<Boolean> consumer,
boolean[] arr) |
static void |
forEach(Consumer<Byte> consumer,
byte[] arr) |
static void |
forEach(Consumer<Character> consumer,
char[] arr) |
static void |
forEach(Consumer<Double> consumer,
double[] arr) |
static void |
forEach(Consumer<Float> consumer,
float[] arr) |
static void |
forEach(Consumer<Integer> consumer,
int[] arr) |
static void |
forEach(Consumer<Long> consumer,
long[] arr) |
static void |
forEach(Consumer<Short> consumer,
short[] arr) |
static <T> void |
forEach(Consumer<T> consumer,
T[] arr)
消费对象
|
static boolean |
get(boolean[] arr,
int i) |
static byte |
get(byte[] arr,
int i) |
static char |
get(char[] arr,
int i) |
static double |
get(double[] arr,
int i) |
static float |
get(float[] arr,
int i) |
static int |
get(int[] arr,
int i) |
static long |
get(long[] arr,
int i) |
static short |
get(short[] arr,
int i) |
static <T> T |
get(T[] arr,
int i) |
static <T> T |
getIfPresent(T[] arr,
int i)
获取元素 如果元素存在
|
static <T> T |
gets(Object arr,
int i)
获取数组下标对应的值
|
static int |
hashCode(boolean[] arr) |
static int |
hashCode(byte[] arr) |
static int |
hashCode(char[] arr) |
static int |
hashCode(double[] arr) |
static int |
hashCode(float[] arr) |
static int |
hashCode(int[] arr) |
static int |
hashCode(long[] arr) |
static int |
hashCode(Object[] arr)
获取数组的hashCode
|
static int |
hashCode(short[] arr) |
static int |
indexOf(boolean[] arr,
boolean s) |
static int |
indexOf(boolean[] arr,
boolean s,
int start) |
static int |
indexOf(byte[] arr,
byte s) |
static int |
indexOf(byte[] arr,
byte s,
int start)
查找第一个查询到的元素的位置
|
static int |
indexOf(char[] arr,
char s) |
static int |
indexOf(char[] arr,
char s,
int start) |
static int |
indexOf(double[] arr,
double s) |
static int |
indexOf(double[] arr,
double s,
int start) |
static int |
indexOf(float[] arr,
float s) |
static int |
indexOf(float[] arr,
float s,
int start) |
static int |
indexOf(int[] arr,
int s) |
static int |
indexOf(int[] arr,
int s,
int start) |
static int |
indexOf(long[] arr,
long s) |
static int |
indexOf(long[] arr,
long s,
int start) |
static int |
indexOf(short[] arr,
short s) |
static int |
indexOf(short[] arr,
short s,
int start) |
static <T> int |
indexOf(T[] arr,
T s) |
static <T> int |
indexOf(T[] arr,
T s,
int start) |
static boolean |
isArray(Object o)
判断对象是否为数组
|
static boolean |
isBaseArray(Object o)
判断是否是基本类型的数组
|
static boolean |
isEmpties(Object arr)
判断数组是否为空
|
static boolean |
isEmpty(boolean[] arr) |
static boolean |
isEmpty(byte[] arr) |
static boolean |
isEmpty(char[] arr) |
static boolean |
isEmpty(double[] arr) |
static boolean |
isEmpty(float[] arr) |
static boolean |
isEmpty(int[] arr) |
static boolean |
isEmpty(long[] arr) |
static boolean |
isEmpty(short[] arr) |
static <T> boolean |
isEmpty(T[] arr) |
static boolean |
isNotBaseArray(Object o)
判断是否不是基本类型的数组
|
static boolean |
isNotEmpties(Object arr)
判断数组是否不为空
|
static boolean |
isNotEmpty(boolean[] arr) |
static boolean |
isNotEmpty(byte[] arr) |
static boolean |
isNotEmpty(char[] arr) |
static boolean |
isNotEmpty(double[] arr) |
static boolean |
isNotEmpty(float[] arr) |
static boolean |
isNotEmpty(int[] arr) |
static boolean |
isNotEmpty(long[] arr) |
static boolean |
isNotEmpty(short[] arr) |
static <T> boolean |
isNotEmpty(T[] arr) |
static boolean |
isWrapArray(Object o)
判断是否是包装类型的数组
|
static boolean |
isWrapBaseArray(Object o)
判断是否不是包装类型的数组
|
static boolean |
last(boolean[] arr) |
static boolean |
last(boolean[] arr,
boolean def) |
static byte |
last(byte[] arr) |
static byte |
last(byte[] arr,
byte def) |
static char |
last(char[] arr) |
static char |
last(char[] arr,
char def) |
static double |
last(double[] arr) |
static double |
last(double[] arr,
double def) |
static float |
last(float[] arr) |
static float |
last(float[] arr,
float def) |
static int |
last(int[] arr) |
static int |
last(int[] arr,
int def) |
static long |
last(long[] arr) |
static long |
last(long[] arr,
long def) |
static short |
last(short[] arr) |
static short |
last(short[] arr,
short def) |
static <T> T |
last(T[] arr)
获取数组最后一个元素
|
static <T> T |
last(T[] arr,
T def)
获取数组最后一个元素
|
static int |
lastIndexOf(boolean[] arr,
boolean s) |
static int |
lastIndexOf(boolean[] arr,
boolean s,
int start) |
static int |
lastIndexOf(byte[] arr,
byte s) |
static int |
lastIndexOf(byte[] arr,
byte s,
int start)
查找最后一个查询到的元素的位置
|
static int |
lastIndexOf(char[] arr,
char s) |
static int |
lastIndexOf(char[] arr,
char s,
int start) |
static int |
lastIndexOf(double[] arr,
double s) |
static int |
lastIndexOf(double[] arr,
double s,
int start) |
static int |
lastIndexOf(float[] arr,
float s) |
static int |
lastIndexOf(float[] arr,
float s,
int start) |
static int |
lastIndexOf(int[] arr,
int s) |
static int |
lastIndexOf(int[] arr,
int s,
int start) |
static int |
lastIndexOf(long[] arr,
long s) |
static int |
lastIndexOf(long[] arr,
long s,
int start) |
static int |
lastIndexOf(short[] arr,
short s) |
static int |
lastIndexOf(short[] arr,
short s,
int start) |
static <T> int |
lastIndexOf(T[] arr,
T s) |
static <T> int |
lastIndexOf(T[] arr,
T s,
int start) |
static int |
length(boolean[] arr) |
static int |
length(byte[] arr) |
static int |
length(char[] arr) |
static int |
length(double[] arr) |
static int |
length(float[] arr) |
static int |
length(int[] arr) |
static int |
length(long[] arr) |
static int |
length(short[] arr) |
static <T> int |
length(T[] arr) |
static int |
lengths(Object... arr)
获取数组长度
|
static int |
lens(Object arr) |
static <I,O> O[] |
mapper(I[] arr,
IntFunction<? extends O[]> generator,
Mapper<? super I,? extends O> mapper)
映射
|
static byte |
max(byte[] arr)
最大值
|
static char |
max(char[] arr) |
static double |
max(double[] arr) |
static float |
max(float[] arr) |
static int |
max(int[] arr) |
static long |
max(long[] arr) |
static short |
max(short[] arr) |
static <T extends Comparable<T>> |
max(T[] arr) |
static <T> T |
max(T[] arr,
Comparator<T> c) |
static boolean[] |
merge(boolean[] arr,
boolean[]... merge) |
static byte[] |
merge(byte[] arr,
byte[]... merge) |
static char[] |
merge(char[] arr,
char[]... merge) |
static double[] |
merge(double[] arr,
double[]... merge) |
static float[] |
merge(float[] arr,
float[]... merge) |
static int[] |
merge(int[] arr,
int[]... merge) |
static long[] |
merge(long[] arr,
long[]... merge) |
static Object[] |
merge(Object[] arr,
Object[]... merge) |
static short[] |
merge(short[] arr,
short[]... merge) |
static <T> T[] |
merges(IntFunction<T[]> generator,
T[] arr,
T[]... merge)
合并数组
|
static byte |
min(byte[] arr)
最小值
|
static char |
min(char[] arr) |
static double |
min(double[] arr) |
static float |
min(float[] arr) |
static int |
min(int[] arr) |
static long |
min(long[] arr) |
static short |
min(short[] arr) |
static <T extends Comparable<T>> |
min(T[] arr) |
static <T> T |
min(T[] arr,
Comparator<T> c) |
static <T> T[] |
newArrays(Class<T> type,
int length)
创建数组
|
static <T> T[] |
newArrays(IntFunction<T[]> generator,
int length)
创建数组
|
static boolean[] |
newBooleans(int len) |
static byte[] |
newBytes(int len)
创建数组
|
static char[] |
newChars(int len) |
static double[] |
newDoubles(int len) |
static float[] |
newFloats(int len) |
static int[] |
newInts(int len) |
static long[] |
newLongs(int len) |
static Object[] |
newObjects(int len) |
static short[] |
newShorts(int len) |
static boolean[] |
of(boolean... arr) |
static byte[] |
of(byte... arr)
将可变参数转化为数组
|
static char[] |
of(char... arr) |
static double[] |
of(double... arr) |
static float[] |
of(float... arr) |
static int[] |
of(int... arr) |
static long[] |
of(long... arr) |
static short[] |
of(short... arr) |
static <T> T[] |
of(T... arr)
不可接收基本类型的数组, 可以使用包装类 否则会返回 T[][]
|
static Object[] |
ofs(Object... arr)
可接收基本类型的数组, 返回Object[]
|
static boolean |
random(boolean[] arr) |
static byte |
random(byte[] arr) |
static char |
random(char[] arr) |
static double |
random(double[] arr) |
static float |
random(float[] arr) |
static int |
random(int[] arr) |
static long |
random(long[] arr) |
static short |
random(short[] arr) |
static <T> T |
random(T[] arr) |
static <V,R> R |
reduce(V[] arr,
Reduce<? super V,? extends R> reduce)
规约
|
static boolean[] |
resize(boolean[] arr,
int newSize) |
static byte[] |
resize(byte[] arr,
int newSize)
调整数组大小
|
static char[] |
resize(char[] arr,
int newSize) |
static double[] |
resize(double[] arr,
int newSize) |
static float[] |
resize(float[] arr,
int newSize) |
static int[] |
resize(int[] arr,
int newSize) |
static long[] |
resize(long[] arr,
int newSize) |
static Object[] |
resize(Object[] arr,
int newSize) |
static short[] |
resize(short[] arr,
int newSize) |
static <T> T[] |
resize(T[] arr,
int newSize,
IntFunction<T[]> generator) |
static void |
reverse(boolean[] arr) |
static void |
reverse(byte[] arr)
数组倒排
|
static void |
reverse(char[] arr) |
static void |
reverse(double[] arr) |
static void |
reverse(float[] arr) |
static void |
reverse(int[] arr) |
static void |
reverse(long[] arr) |
static void |
reverse(short[] arr) |
static <T> void |
reverse(T[] arr) |
static void |
set(boolean[] arr,
int i,
boolean value) |
static void |
set(byte[] arr,
int i,
byte value) |
static void |
set(char[] arr,
int i,
char value) |
static void |
set(double[] arr,
int i,
double value) |
static void |
set(float[] arr,
int i,
float value) |
static void |
set(int[] arr,
int i,
int value) |
static void |
set(long[] arr,
int i,
long value) |
static void |
set(short[] arr,
int i,
short value) |
static <T> void |
set(T[] arr,
int i,
T value) |
static <T> void |
sets(Object arr,
int i,
T value)
设置数组下标对应的值
|
static boolean |
some(boolean target,
boolean... arr) |
static boolean |
some(byte target,
byte... arr) |
static boolean |
some(char target,
char... arr) |
static boolean |
some(double target,
double... arr) |
static boolean |
some(float target,
float... arr) |
static boolean |
some(int target,
int... arr) |
static boolean |
some(long target,
long... arr) |
static boolean |
some(short target,
short... arr) |
static <T> boolean |
some(T target,
T... arr)
查询目标元素是否出现在数组中
|
static void |
swap(boolean[] arr,
int i,
int j) |
static void |
swap(byte[] arr,
int i,
int j) |
static void |
swap(char[] arr,
int i,
int j) |
static void |
swap(double[] arr,
int i,
int j) |
static void |
swap(float[] arr,
int i,
int j) |
static void |
swap(int[] arr,
int i,
int j) |
static void |
swap(long[] arr,
int i,
int j) |
static void |
swap(short[] arr,
int i,
int j) |
static <T> void |
swap(T[] arr,
int i,
int j) |
static boolean[] |
toBooleanArray(String s,
String split) |
static byte[] |
toByteArray(String s,
String split) |
static double[] |
toDoubleArray(String s,
String split) |
static float[] |
toFloatArray(String s,
String split) |
static int[] |
toIntArray(String s,
String split) |
static long[] |
toLongArray(String s,
String split) |
static short[] |
toShortArray(String s,
String split) |
static String[] |
toStringArray(String s,
String split) |
static void |
unChangeSwap(byte[] arr,
int i,
int j)
换位
|
static boolean[] |
unWrap(Boolean[] arr) |
static byte[] |
unWrap(Byte[] arr)
将数组转化为其基本装类
|
static char[] |
unWrap(Character[] arr) |
static double[] |
unWrap(Double[] arr) |
static float[] |
unWrap(Float[] arr) |
static int[] |
unWrap(Integer[] arr) |
static long[] |
unWrap(Long[] arr) |
static Object |
unWrap(Object arr) |
static short[] |
unWrap(Short[] arr) |
static Boolean[] |
wrap(boolean[] arr) |
static Byte[] |
wrap(byte[] w)
将数组转化为其包装类
|
static Character[] |
wrap(char[] arr) |
static Double[] |
wrap(double[] arr) |
static Float[] |
wrap(float[] arr) |
static Integer[] |
wrap(int[] arr) |
static Long[] |
wrap(long[] arr) |
static Object |
wrap(Object arr) |
static Short[] |
wrap(short[] w) |
public static byte[] newBytes(int len)
len
- 数组长度public static short[] newShorts(int len)
public static int[] newInts(int len)
public static long[] newLongs(int len)
public static float[] newFloats(int len)
public static double[] newDoubles(int len)
public static char[] newChars(int len)
public static boolean[] newBooleans(int len)
public static Object[] newObjects(int len)
public static <T> T[] newArrays(Class<T> type, int length)
T
- ignoretype
- 类型length
- 空间public static <T> T[] newArrays(IntFunction<T[]> generator, int length)
T
- ignoregenerator
- e.g. Integer[]::newlength
- 空间public static boolean isArray(Object o)
o
- 对象public static boolean isBaseArray(Object o)
o
- 对象public static boolean isWrapArray(Object o)
o
- 对象public static boolean isNotBaseArray(Object o)
o
- 对象public static boolean isWrapBaseArray(Object o)
o
- 对象public static <T> T gets(Object arr, int i)
T
- ignorearr
- 数组i
- 下标public static <T> T getIfPresent(T[] arr, int i)
T
- Tarr
- listi
- ipublic static <T> T get(T[] arr, int i)
public static byte get(byte[] arr, int i)
public static short get(short[] arr, int i)
public static int get(int[] arr, int i)
public static long get(long[] arr, int i)
public static float get(float[] arr, int i)
public static double get(double[] arr, int i)
public static boolean get(boolean[] arr, int i)
public static char get(char[] arr, int i)
public static <T> void sets(Object arr, int i, T value)
T
- ignorearr
- 数组i
- 下标value
- 值public static <T> void set(T[] arr, int i, T value)
public static void set(byte[] arr, int i, byte value)
public static void set(short[] arr, int i, short value)
public static void set(int[] arr, int i, int value)
public static void set(long[] arr, int i, long value)
public static void set(float[] arr, int i, float value)
public static void set(double[] arr, int i, double value)
public static void set(boolean[] arr, int i, boolean value)
public static void set(char[] arr, int i, char value)
public static <T> T random(T[] arr)
public static byte random(byte[] arr)
public static short random(short[] arr)
public static int random(int[] arr)
public static long random(long[] arr)
public static float random(float[] arr)
public static double random(double[] arr)
public static boolean random(boolean[] arr)
public static char random(char[] arr)
public static <I,O> O[] mapper(I[] arr, IntFunction<? extends O[]> generator, Mapper<? super I,? extends O> mapper)
I
- 输入类型O
- 输出类型arr
- 需要映射的对象generator
- 数组创建接口 e.g. Integer[]::newmapper
- 映射接口public static <V,R> R reduce(V[] arr, Reduce<? super V,? extends R> reduce)
V
- 数据类型R
- 规约类型reduce
- 规约接口arr
- 需要规约的对象 该对象不能为基本类型的数组, 可以为基本类型的变量public static Object[] compact(Object[] arr)
arr
- 数组public static <T> T[] compacts(T[] arr, IntFunction<T[]> generator)
public static byte[] exclude(byte[] arr, byte... es)
arr
- 数组es
- 排除值public static short[] exclude(short[] arr, short... es)
public static int[] exclude(int[] arr, int... es)
public static long[] exclude(long[] arr, long... es)
public static float[] exclude(float[] arr, float... es)
public static double[] exclude(double[] arr, double... es)
public static boolean[] exclude(boolean[] arr, boolean... es)
public static char[] exclude(char[] arr, char... es)
public static Object[] exclude(Object[] arr, Object... es)
arr
- 数组es
- 排除值 这个值可以为基本类型的元素, 但是不能是基本类型的数组@SafeVarargs public static <T> T[] excludes(T[] arr, IntFunction<T[]> generator, T... es)
public static <T> T[] excludes(T[] arr, Predicate<T> p, IntFunction<T[]> generator)
public static <T> void forEach(Consumer<T> consumer, T[] arr)
T
- 对象类型consumer
- 消费函数arr
- 元素public static byte[] of(byte... arr)
arr
- 可边参数public static short[] of(short... arr)
public static int[] of(int... arr)
public static long[] of(long... arr)
public static float[] of(float... arr)
public static double[] of(double... arr)
public static boolean[] of(boolean... arr)
public static char[] of(char... arr)
@SafeVarargs public static <T> T[] of(T... arr)
T
- arrarr
- arrpublic static Object[] ofs(Object... arr)
arr
- arrpublic static boolean isEmpties(Object arr)
arr
- 数组public static <T> boolean isEmpty(T[] arr)
public static boolean isEmpty(byte[] arr)
public static boolean isEmpty(short[] arr)
public static boolean isEmpty(int[] arr)
public static boolean isEmpty(long[] arr)
public static boolean isEmpty(float[] arr)
public static boolean isEmpty(double[] arr)
public static boolean isEmpty(boolean[] arr)
public static boolean isEmpty(char[] arr)
public static boolean isNotEmpties(Object arr)
arr
- 数组public static <T> boolean isNotEmpty(T[] arr)
public static boolean isNotEmpty(byte[] arr)
public static boolean isNotEmpty(short[] arr)
public static boolean isNotEmpty(int[] arr)
public static boolean isNotEmpty(long[] arr)
public static boolean isNotEmpty(float[] arr)
public static boolean isNotEmpty(double[] arr)
public static boolean isNotEmpty(boolean[] arr)
public static boolean isNotEmpty(char[] arr)
public static <T> T[] def(T[] arr, T[] def)
arr
- arrpublic static byte[] def(byte[] arr, byte[] def)
public static short[] def(short[] arr, short[] def)
public static int[] def(int[] arr, int[] def)
public static long[] def(long[] arr, long[] def)
public static float[] def(float[] arr, float[] def)
public static double[] def(double[] arr, double[] def)
public static boolean[] def(boolean[] arr, boolean[] def)
public static char[] def(char[] arr, char[] def)
public static <T> T[] def(T[] arr, Supplier<T[]> def)
public static byte[] def(byte[] arr, Supplier<byte[]> def)
public static short[] def(short[] arr, Supplier<short[]> def)
public static int[] def(int[] arr, Supplier<int[]> def)
public static long[] def(long[] arr, Supplier<long[]> def)
public static float[] def(float[] arr, Supplier<float[]> def)
public static double[] def(double[] arr, Supplier<double[]> def)
public static boolean[] def(boolean[] arr, Supplier<boolean[]> def)
public static char[] def(char[] arr, Supplier<char[]> def)
public static int lengths(Object... arr)
arr
- 数组 如果传参是一个基本类型数组, 返回值也是基本类型数组的长度在默认情况下, 如果可变参数o, 传参是基本类型的数组, 使用length属性判断, o.length = 1
public static int lens(Object arr)
public static byte[] resize(byte[] arr, int newSize)
arr
- 原数组newSize
- 新长度public static short[] resize(short[] arr, int newSize)
public static int[] resize(int[] arr, int newSize)
public static long[] resize(long[] arr, int newSize)
public static float[] resize(float[] arr, int newSize)
public static double[] resize(double[] arr, int newSize)
public static boolean[] resize(boolean[] arr, int newSize)
public static char[] resize(char[] arr, int newSize)
public static <T> T[] resize(T[] arr, int newSize, IntFunction<T[]> generator)
public static byte[] arraycopy(byte[] src, int srcPos, byte[] dest, int destPos, int length)
src
- 原数组srcPos
- 原数组起始位置dest
- 目标数组destPos
- 目标数组起始位置length
- 拷贝原数组几位到目标数组public static short[] arraycopy(short[] src, int srcPos, short[] dest, int destPos, int length)
public static int[] arraycopy(int[] src, int srcPos, int[] dest, int destPos, int length)
public static long[] arraycopy(long[] src, int srcPos, long[] dest, int destPos, int length)
public static float[] arraycopy(float[] src, int srcPos, float[] dest, int destPos, int length)
public static double[] arraycopy(double[] src, int srcPos, double[] dest, int destPos, int length)
public static boolean[] arraycopy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length)
public static char[] arraycopy(char[] src, int srcPos, char[] dest, int destPos, int length)
public static Object[] arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length)
public static <T> T[] arraycopys(T[] src, int srcPos, T[] dest, int destPos, int length, IntFunction<T[]> generator)
public static <T> int length(T[] arr)
public static int length(byte[] arr)
public static int length(short[] arr)
public static int length(int[] arr)
public static int length(long[] arr)
public static int length(float[] arr)
public static int length(double[] arr)
public static int length(char[] arr)
public static int length(boolean[] arr)
public static Byte[] wrap(byte[] w)
w
- 数组public static Short[] wrap(short[] w)
public static Integer[] wrap(int[] arr)
public static Long[] wrap(long[] arr)
public static Float[] wrap(float[] arr)
public static Double[] wrap(double[] arr)
public static Boolean[] wrap(boolean[] arr)
public static Character[] wrap(char[] arr)
public static byte[] unWrap(Byte[] arr)
arr
- 数组public static short[] unWrap(Short[] arr)
public static int[] unWrap(Integer[] arr)
public static long[] unWrap(Long[] arr)
public static float[] unWrap(Float[] arr)
public static double[] unWrap(Double[] arr)
public static boolean[] unWrap(Boolean[] arr)
public static char[] unWrap(Character[] arr)
@SafeVarargs public static <T> T[] merges(IntFunction<T[]> generator, T[] arr, T[]... merge)
T
- ignoregenerator
- e.g. Integer[]::newarr
- 需要合并的数组merge
- 需要合并的数组public static byte[] merge(byte[] arr, byte[]... merge)
public static short[] merge(short[] arr, short[]... merge)
public static int[] merge(int[] arr, int[]... merge)
public static long[] merge(long[] arr, long[]... merge)
public static float[] merge(float[] arr, float[]... merge)
public static double[] merge(double[] arr, double[]... merge)
public static boolean[] merge(boolean[] arr, boolean[]... merge)
public static char[] merge(char[] arr, char[]... merge)
public static int indexOf(byte[] arr, byte s, int start)
arr
- 数组s
- 元素start
- 开始向后查找的下标public static int indexOf(short[] arr, short s, int start)
public static int indexOf(int[] arr, int s, int start)
public static int indexOf(long[] arr, long s, int start)
public static int indexOf(float[] arr, float s, int start)
public static int indexOf(double[] arr, double s, int start)
public static int indexOf(char[] arr, char s, int start)
public static int indexOf(boolean[] arr, boolean s, int start)
public static <T> int indexOf(T[] arr, T s, int start)
public static int indexOf(byte[] arr, byte s)
public static int indexOf(short[] arr, short s)
public static int indexOf(int[] arr, int s)
public static int indexOf(long[] arr, long s)
public static int indexOf(float[] arr, float s)
public static int indexOf(double[] arr, double s)
public static int indexOf(char[] arr, char s)
public static int indexOf(boolean[] arr, boolean s)
public static <T> int indexOf(T[] arr, T s)
public static int lastIndexOf(byte[] arr, byte s, int start)
arr
- 数组s
- 元素start
- 开始向前查找的下标public static int lastIndexOf(short[] arr, short s, int start)
public static int lastIndexOf(int[] arr, int s, int start)
public static int lastIndexOf(long[] arr, long s, int start)
public static int lastIndexOf(float[] arr, float s, int start)
public static int lastIndexOf(double[] arr, double s, int start)
public static int lastIndexOf(char[] arr, char s, int start)
public static int lastIndexOf(boolean[] arr, boolean s, int start)
public static <T> int lastIndexOf(T[] arr, T s, int start)
public static int lastIndexOf(byte[] arr, byte s)
public static int lastIndexOf(short[] arr, short s)
public static int lastIndexOf(int[] arr, int s)
public static int lastIndexOf(long[] arr, long s)
public static int lastIndexOf(float[] arr, float s)
public static int lastIndexOf(double[] arr, double s)
public static int lastIndexOf(char[] arr, char s)
public static int lastIndexOf(boolean[] arr, boolean s)
public static <T> int lastIndexOf(T[] arr, T s)
public static boolean contains(byte[] arr, byte s)
arr
- 数组s
- 元素public static boolean contains(short[] arr, short s)
public static boolean contains(int[] arr, int s)
public static boolean contains(long[] arr, long s)
public static boolean contains(float[] arr, float s)
public static boolean contains(double[] arr, double s)
public static boolean contains(char[] arr, char s)
public static boolean contains(boolean[] arr, boolean s)
public static <T> boolean contains(T[] arr, T s)
@SafeVarargs public static <T> int count(T target, T... arr)
target
- 目标元素arr
- 数组 可以传基本类型的元素 但是不可以传基本类型的数组public static int count(byte target, byte... arr)
public static int count(short target, short... arr)
public static int count(int target, int... arr)
public static int count(long target, long... arr)
public static int count(float target, float... arr)
public static int count(double target, double... arr)
public static int count(boolean target, boolean... arr)
public static int count(char target, char... arr)
@SafeVarargs public static <T> boolean some(T target, T... arr)
target
- 目标元素arr
- 数组, 可以传基本类型的元素, 但是不可以传基本类型的数组public static boolean some(byte target, byte... arr)
public static boolean some(short target, short... arr)
public static boolean some(int target, int... arr)
public static boolean some(long target, long... arr)
public static boolean some(float target, float... arr)
public static boolean some(double target, double... arr)
public static boolean some(char target, char... arr)
public static boolean some(boolean target, boolean... arr)
public static void reverse(byte[] arr)
arr
- 数组public static void reverse(short[] arr)
public static void reverse(int[] arr)
public static void reverse(long[] arr)
public static void reverse(float[] arr)
public static void reverse(double[] arr)
public static void reverse(char[] arr)
public static void reverse(boolean[] arr)
public static <T> void reverse(T[] arr)
public static <T> T first(T[] arr)
arr
- arraypublic static byte first(byte[] arr)
public static short first(short[] array)
public static int first(int[] arr)
public static long first(long[] arr)
public static float first(float[] arr)
public static double first(double[] arr)
public static boolean first(boolean[] arr)
public static char first(char[] arr)
public static <T> T first(T[] arr, T def)
arr
- arraydef
- 默认值public static byte first(byte[] arr, byte def)
public static short first(short[] arr, short def)
public static int first(int[] arr, int def)
public static long first(long[] arr, long def)
public static float first(float[] arr, float def)
public static double first(double[] arr, double def)
public static boolean first(boolean[] arr, boolean def)
public static char first(char[] arr, char def)
public static <T> T last(T[] arr)
arr
- arraypublic static byte last(byte[] arr)
public static short last(short[] arr)
public static int last(int[] arr)
public static long last(long[] arr)
public static float last(float[] arr)
public static double last(double[] arr)
public static boolean last(boolean[] arr)
public static char last(char[] arr)
public static <T> T last(T[] arr, T def)
arr
- arraydef
- 默认值public static byte last(byte[] arr, byte def)
public static short last(short[] arr, short def)
public static int last(int[] arr, int def)
public static long last(long[] arr, long def)
public static float last(float[] arr, float def)
public static double last(double[] arr, double def)
public static boolean last(boolean[] arr, boolean def)
public static char last(char[] arr, char def)
public static void unChangeSwap(byte[] arr, int i, int j)
arr
- 数组i
- 换位的元素1j
- 换位的元素2public static void swap(byte[] arr, int i, int j)
public static void swap(short[] arr, int i, int j)
public static void swap(int[] arr, int i, int j)
public static void swap(long[] arr, int i, int j)
public static void swap(float[] arr, int i, int j)
public static void swap(double[] arr, int i, int j)
public static void swap(char[] arr, int i, int j)
public static void swap(boolean[] arr, int i, int j)
public static <T> void swap(T[] arr, int i, int j)
public static byte max(byte[] arr)
arr
- 数组public static short max(short[] arr)
public static int max(int[] arr)
public static long max(long[] arr)
public static float max(float[] arr)
public static double max(double[] arr)
public static char max(char[] arr)
public static <T extends Comparable<T>> T max(T[] arr)
public static <T> T max(T[] arr, Comparator<T> c)
public static byte min(byte[] arr)
arr
- 数组public static short min(short[] arr)
public static int min(int[] arr)
public static long min(long[] arr)
public static float min(float[] arr)
public static double min(double[] arr)
public static char min(char[] arr)
public static <T extends Comparable<T>> T min(T[] arr)
public static <T> T min(T[] arr, Comparator<T> c)
public static int hashCode(Object[] arr)
arr
- arrpublic static int hashCode(byte[] arr)
public static int hashCode(short[] arr)
public static int hashCode(int[] arr)
public static int hashCode(long[] arr)
public static int hashCode(float[] arr)
public static int hashCode(double[] arr)
public static int hashCode(boolean[] arr)
public static int hashCode(char[] arr)
Copyright © 2024. All rights reserved.