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 < 0
NullPointerException
- if original == null
public 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 < 0
NullPointerException
- if original == null
public 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 < 0
NullPointerException
- if original == null
public 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.length
IllegalArgumentException
- if start > end
NullPointerException
- if original == null
public 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.length
IllegalArgumentException
- if start > end
NullPointerException
- if original == null
public 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.length
IllegalArgumentException
- if start > end
NullPointerException
- if original == null
Copyright © 2012-2014 FasterXML. All Rights Reserved.