| Constructor and Description |
|---|
ArraysCompat() |
| Modifier and Type | Method and Description |
|---|---|
static char[] |
copyOf(char[] original,
int newLength)
Copies
newLength elements from original into a new array. |
static int[] |
copyOf(int[] original,
int newLength)
Copies
newLength elements from original into a new array. |
static <T> T[] |
copyOf(T[] original,
int newLength)
Copies
newLength elements from original into a new array. |
static char[] |
copyOfRange(char[] original,
int start,
int end)
Copies elements from
original into a new array, from indexes start (inclusive) to
end (exclusive). |
static int[] |
copyOfRange(int[] original,
int start,
int end)
Copies elements from
original into a new array, from indexes start (inclusive) to
end (exclusive). |
static <T> T[] |
copyOfRange(T[] original,
int start,
int end)
Copies elements from
original into a new array, from indexes start (inclusive) to
end (exclusive). |
public static char[] copyOf(char[] original,
int newLength)
newLength elements from original into a new array.
If newLength is greater than original.length, the result is padded
with the value '\\u0000'.original - the original arraynewLength - the length of the new arrayNegativeArraySizeException - if newLength < 0NullPointerException - if original == nullpublic static int[] copyOf(int[] original,
int newLength)
newLength elements from original into a new array.
If newLength is greater than original.length, the result is padded
with the value 0.original - the original arraynewLength - the length of the new arrayNegativeArraySizeException - if newLength < 0NullPointerException - if original == nullpublic static <T> T[] copyOf(T[] original,
int newLength)
newLength elements from original into a new array.
If newLength is greater than original.length, the result is padded
with the value null.original - the original arraynewLength - the length of the new arrayNegativeArraySizeException - if newLength < 0NullPointerException - if original == nullpublic static char[] copyOfRange(char[] original,
int start,
int end)
original into a new array, from indexes start (inclusive) to
end (exclusive). The original order of elements is preserved.
If end is greater than original.length, the result is padded
with the value '\\u0000'.original - the original arraystart - the start index, inclusiveend - the end index, exclusiveArrayIndexOutOfBoundsException - if start < 0 || start > original.lengthIllegalArgumentException - if start > endNullPointerException - if original == nullpublic static int[] copyOfRange(int[] original,
int start,
int end)
original into a new array, from indexes start (inclusive) to
end (exclusive). The original order of elements is preserved.
If end is greater than original.length, the result is padded
with the value 0.original - the original arraystart - the start index, inclusiveend - the end index, exclusiveArrayIndexOutOfBoundsException - if start < 0 || start > original.lengthIllegalArgumentException - if start > endNullPointerException - if original == nullpublic static <T> T[] copyOfRange(T[] original,
int start,
int end)
original into a new array, from indexes start (inclusive) to
end (exclusive). The original order of elements is preserved.
If end is greater than original.length, the result is padded
with the value null.original - the original arraystart - the start index, inclusiveend - the end index, exclusiveArrayIndexOutOfBoundsException - if start < 0 || start > original.lengthIllegalArgumentException - if start > endNullPointerException - if original == nullCopyright © 2012-2015 FasterXML. All Rights Reserved.