public class ArrayTool extends Object
Constructor and Description |
---|
ArrayTool() |
Modifier and Type | Method and Description |
---|---|
static Object[] |
concatArrays(Object[] a,
Object o)
Creates and copy a new array that has appended a object in the end of a
source array
|
static Object[] |
concatArrays(Object[] a,
Object[] b)
Creates a copies a new array that is the concatenation of two.
|
static <T> T[] |
copyOfRange(T[] original,
int from,
int to)
Returns a subarray from the original array
from from to tt.
|
public static Object[] concatArrays(Object[] a, Object[] b)
a
- first array in the copyb
- second array in the copypublic static <T> T[] copyOfRange(T[] original, int from, int to)
The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to).
Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
The resulting array is of exactly the same class as the original array.
original
- the array from which a range is to be copiedfrom
- the initial index of the range to be copied, inclusiveto
- the final index of the range to be copied, exclusive.
(This index may lie outside the array.)ArrayIndexOutOfBoundsException
- if from < 0
or from > original.length
IllegalArgumentException
- if from > toNullPointerException
- if original is null