org.apache.wicket.util.lang
Class Arrays
java.lang.Object
org.apache.wicket.util.lang.Arrays
public class Arrays
- extends java.lang.Object
Arrays
contains static methods which operate on arrays. This code is taken from the
Apache Harmony JDK, licensed under the Apache Software License 2.0.
- Since:
- 1.2
Method Summary |
static
|
copyOf(T[] original,
int newLength)
Copies specified number of elements in original array to a new array. |
static
|
copyOfRange(T[] original,
int start,
int end)
Copies elements in original array to a new array, from index start(inclusive) to
end(exclusive). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Arrays
public Arrays()
copyOf
public static <T> T[] copyOf(T[] original,
int newLength)
- Copies specified number of elements in original array to a new array. The padding value whose
index is bigger than or equal to original.length is null.
- Type Parameters:
T
- type of element in array- Parameters:
original
- the original arraynewLength
- the length of copied array
- Returns:
- the new array
- Throws:
java.lang.NegativeArraySizeException
- if the newLength is smaller than zero
java.lang.NullPointerException
- if the original array is null- Since:
- 1.6
copyOfRange
public static <T> T[] copyOfRange(T[] original,
int start,
int end)
- Copies elements in original array to a new array, from index start(inclusive) to
end(exclusive). The first element (if any) in the new array is original[from], and other
elements in the new array are in the original order. The padding value whose index is bigger
than or equal to original.length - start is null.
- Type Parameters:
T
- type of element in array- Parameters:
original
- the original arraystart
- the start index, inclusiveend
- the end index, exclusive, may bigger than length of the array
- Returns:
- the new copied array
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if start is smaller than 0 or bigger than original.length
java.lang.IllegalArgumentException
- if start is bigger than end
java.lang.NullPointerException
- if original is null- Since:
- 1.6
Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.