public class Arrs extends Object
| 构造器和说明 |
|---|
Arrs() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <E> E[] |
createArray(Class<E> componentType,
int length)
Create an array with the specified length
|
static <E> E[] |
createArray(Class<E> componentType,
int length,
E initValue)
Create an array with the specified length and every element's value is the specified initValue
|
static <E> E[] |
createArray(Class<E> componentType,
int length,
Supplier<Integer,E> initSupplier)
Create an array with the specified length and every element's value is supplied by the specified initSupplier
|
static boolean |
deepEquals(Object[] a1,
Object[] a2) |
static boolean |
deepEquals(Object e1,
Object e2) |
static int |
getLength(Object object)
get the length if argument is an array, else -1
|
static <E> void |
initArray(E[] array,
E initValue) |
static <E> void |
initArray(E[] array,
Supplier<Integer,E> initSupplier) |
static boolean |
isArray(Object o)
judge whether an object is an Array
|
static boolean |
isNegativeIndex(int length,
int index)
判断是否为负数索引
|
static boolean |
isPositiveIndex(int length,
int index)
判断是否为正数索引
|
static boolean |
isValidIndex(int length,
int index)
判断索引是否有效
|
static Integer[] |
range(int end)
It is similar to Python's range(start, end, step)
[start, end)
|
static Integer[] |
range(int start,
int end)
It is similar to Python's range(start, end, step)
[start, end)
|
static Integer[] |
range(int start,
int end,
int step)
It is similar to Python's range(start, end, step)
[start, end)
|
static int |
reverseIndex(int length,
int index)
反转索引
|
static <E> void |
swap(E[] arr,
int i,
int j)
Swaps the two specified elements in the specified array.
|
static <E> E[] |
wrapAsArray(E o)
Wrap any object using new Object[]{object};
|
public static int getLength(Object object)
object - any objectpublic static <E> E[] wrapAsArray(@Nullable E o)
public static <E> E[] createArray(@Nullable Class<E> componentType, int length)
public static <E> E[] createArray(@Nullable Class<E> componentType, int length, @Nullable E initValue)
public static <E> E[] createArray(@Nullable Class<E> componentType, int length, @NonNull Supplier<Integer,E> initSupplier)
public static <E> void initArray(@NonNull E[] array, @NonNull Supplier<Integer,E> initSupplier)
public static Integer[] range(int end)
range(int, int, int)public static Integer[] range(int start, int end)
range(int, int, int)public static Integer[] range(int start, int end, int step)
public static <E> void swap(@NonNull E[] arr, int i, int j)
public static int reverseIndex(int length,
int index)
public static boolean isValidIndex(int length,
int index)
public static boolean isPositiveIndex(int length,
int index)
public static boolean isNegativeIndex(int length,
int index)
Copyright © 2021. All rights reserved.