public final class ArrayUtils extends Object
数组工具类
Description:提供常用的数组克隆、数组合并和截取子数组等功能
| 限定符和类型 | 字段和说明 |
|---|---|
static byte[] |
EMPTY_BYTE_ARRAY |
static char[] |
EMPTY_CHAR_ARRAY |
static int[] |
EMPTY_INT_ARRAY |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
clone(byte[] array)
Clones an array returning a typecast result and handling
null. |
static char[] |
clone(char[] array)
Clones an array returning a typecast result and handling
null. |
static int[] |
clone(int[] array)
Clones an array returning a typecast result and handling
null. |
static <T> T[] |
merge(T[] array,
T element)
Copies the given array and merges the given element at the end of the new
array.
|
static byte[] |
mergeAll(byte[] array1,
byte... array2)
Merges all the elements of the given arrays into a new array.
|
static char[] |
mergeAll(char[] array1,
char... array2)
Merges all the elements of the given arrays into a new array.
|
static int[] |
mergeAll(int[] array1,
int... array2)
Merges all the elements of the given arrays into a new array.
|
static byte[] |
subarray(byte[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new
byte array containing the elements between the
start and end indices. |
static char[] |
subarray(char[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new
char array containing the elements between the
start and end indices. |
static int[] |
subarray(int[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new
int array containing the elements between the
start and end indices. |
static <T> T[] |
subarray(T[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new array containing the elements between the start and end
indices.
|
public static final int[] EMPTY_INT_ARRAY
public static final char[] EMPTY_CHAR_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
public static int[] clone(int[] array)
Clones an array returning a typecast result and handling null.
public static char[] clone(char[] array)
Clones an array returning a typecast result and handling null.
public static byte[] clone(byte[] array)
Clones an array returning a typecast result and handling null.
public static char[] mergeAll(char[] array1,
char... array2)
Merges all the elements of the given arrays into a new array.
public static byte[] mergeAll(byte[] array1,
byte... array2)
Merges all the elements of the given arrays into a new array.
public static int[] mergeAll(int[] array1,
int... array2)
Merges all the elements of the given arrays into a new array.
public static <T> T[] merge(T[] array,
T element)
Copies the given array and merges the given element at the end of the new array.
public static int[] subarray(int[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new int array containing the elements between the
start and end indices.
public static char[] subarray(char[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new char array containing the elements between the
start and end indices.
public static byte[] subarray(byte[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new byte array containing the elements between the
start and end indices.
public static <T> T[] subarray(T[] array,
int startIndexInclusive,
int endIndexExclusive)
Produces a new array containing the elements between the start and end indices.
Copyright © 2018. All rights reserved.