APIdia Launch Partner
Top Description Constructors Methods
com.sun.tools.javac.util

public Class ArrayUtils

extends Object
Class Inheritance
Imports
java.lang.reflect.Array

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static int
calculateNewLength(int currentLength, int maxIndex)

public static <T> T[]

Returns:

possibly reallocated array of length at least maxIndex + 1
ensureCapacity
(T[]
original array
array
,
int
exclusive lower bound for desired length
maxIndex
)

Ensure the given array has length at least maxIndex + 1.

public static byte[]

Returns:

possibly reallocated array of length at least maxIndex + 1
ensureCapacity
(byte[]
original array
array
,
int
exclusive lower bound for desired length
maxIndex
)

Ensure the given array has length at least maxIndex + 1.

public static char[]

Returns:

possibly reallocated array of length at least maxIndex + 1
ensureCapacity
(char[]
original array
array
,
int
exclusive lower bound for desired length
maxIndex
)

Ensure the given array has length at least maxIndex + 1.

public static int[]

Returns:

possibly reallocated array of length at least maxIndex + 1
ensureCapacity
(int[]
original array
array
,
int
exclusive lower bound for desired length
maxIndex
)

Ensure the given array has length at least maxIndex + 1.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ArrayUtilsback to summary
public ArrayUtils()

Method Detail

calculateNewLengthback to summary
private static int calculateNewLength(int currentLength, int maxIndex)
ensureCapacityback to summary
public static <T> T[] ensureCapacity(T[] array, int maxIndex)

Ensure the given array has length at least maxIndex + 1.

Parameters
array:T[]

original array

maxIndex:int

exclusive lower bound for desired length

Returns:T[]

possibly reallocated array of length at least maxIndex + 1

Exceptions
NullPointerException:
if array is null
IllegalArgumentException:
if maxIndex is negative
ensureCapacityback to summary
public static byte[] ensureCapacity(byte[] array, int maxIndex)

Ensure the given array has length at least maxIndex + 1.

Parameters
array:byte[]

original array

maxIndex:int

exclusive lower bound for desired length

Returns:byte[]

possibly reallocated array of length at least maxIndex + 1

Exceptions
NullPointerException:
if array is null
IllegalArgumentException:
if maxIndex is negative
ensureCapacityback to summary
public static char[] ensureCapacity(char[] array, int maxIndex)

Ensure the given array has length at least maxIndex + 1.

Parameters
array:char[]

original array

maxIndex:int

exclusive lower bound for desired length

Returns:char[]

possibly reallocated array of length at least maxIndex + 1

Exceptions
NullPointerException:
if array is null
IllegalArgumentException:
if maxIndex is negative
ensureCapacityback to summary
public static int[] ensureCapacity(int[] array, int maxIndex)

Ensure the given array has length at least maxIndex + 1.

Parameters
array:int[]

original array

maxIndex:int

exclusive lower bound for desired length

Returns:int[]

possibly reallocated array of length at least maxIndex + 1

Exceptions
NullPointerException:
if array is null
IllegalArgumentException:
if maxIndex is negative