Arrays

public class Arrays extends Object

This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists.

The methods in this class all throw a NullPointerException, if the specified array reference is null, except where noted.

The documentation for the methods contained in this class includes briefs description of the implementations. Such descriptions should be regarded as implementation notes, rather than parts of the specification. Implementors should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by sort(Object[]) does not have to be a MergeSort, but it does have to be stable.)

This class is a member of the Java Collections Framework.

Public Method Summary

static <T> List<T>
asList(T... a)
Returns a fixed-size list backed by the specified array.
static int
binarySearch(char[] a, int fromIndex, int toIndex, char key)
Searches a range of the specified array of chars for the specified value using the binary search algorithm.
static int
binarySearch(long[] a, long key)
Searches the specified array of longs for the specified value using the binary search algorithm.
static int
binarySearch(float[] a, int fromIndex, int toIndex, float key)
Searches a range of the specified array of floats for the specified value using the binary search algorithm.
static int
binarySearch(byte[] a, int fromIndex, int toIndex, byte key)
Searches a range of the specified array of bytes for the specified value using the binary search algorithm.
static int
binarySearch(long[] a, int fromIndex, int toIndex, long key)
Searches a range of the specified array of longs for the specified value using the binary search algorithm.
static int
binarySearch(int[] a, int fromIndex, int toIndex, int key)
Searches a range of the specified array of ints for the specified value using the binary search algorithm.
static int
binarySearch(short[] a, int fromIndex, int toIndex, short key)
Searches a range of the specified array of shorts for the specified value using the binary search algorithm.
static <T> int
binarySearch(T[] a, int fromI