Top Description Fields Constructors Methods
com.amazon.ion.impl.bin

public Class IntList

extends Object
Class Inheritance

A list of integer values that grows as necessary. Unlike java.util.List, IntList does not require each int to be boxed. This makes it helpful in use cases where storing Integer leads to excessive time spent in garbage collection.

Field Summary

Modifier and TypeField and Description
private int[]
public static final int
private static final int
private int

Constructor Summary

AccessConstructor and Description
public
IntList()

Constructs a new IntList with a capacity of IntList#DEFAULT_INITIAL_CAPACITY.

public
IntList(final int
The number of ints that can be stored in this IntList before it will need to be reallocated.
initialCapacity
)

Constructs a new IntList with the specified capacity.

public
IntList(final IntList
the IntList to copy.
other
)

Constructs a new IntList that contains all the elements of the given IntList.

Method Summary

Modifier and TypeMethod and Description
public void
add(int
The int to add to the end of the list.
value
)

Appends an int to the end of the list, growing the list if necessary.

public void
clear()

Empties the list.

public int

Returns:

The int at index index in the list.
get
(int
The list index of the desired int.
index
)

Returns the indexth int in the list.

private void
grow()

Reallocates the backing array to accommodate storing more ints.

public boolean

Returns:

true if there are ints stored in the list.
isEmpty
()

public int

Returns:

The number of ints currently stored in the list.
size
()

Accessor.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

databack to summary
private int[] data
DEFAULT_INITIAL_CAPACITYback to summary
public static final int DEFAULT_INITIAL_CAPACITY
GROWTH_MULTIPLIERback to summary
private static final int GROWTH_MULTIPLIER
numberOfValuesback to summary
private int numberOfValues

Constructor Detail

IntListback to summary
public IntList()

Constructs a new IntList with a capacity of IntList#DEFAULT_INITIAL_CAPACITY.

IntListback to summary
public IntList(final int initialCapacity)

Constructs a new IntList with the specified capacity.

Parameters
initialCapacity:int

The number of ints that can be stored in this IntList before it will need to be reallocated.

IntListback to summary
public IntList(final IntList other)

Constructs a new IntList that contains all the elements of the given IntList.

Parameters
other:IntList

the IntList to copy.

Method Detail

addback to summary
public void add(int value)

Appends an int to the end of the list, growing the list if necessary.

Parameters
value:int

The int to add to the end of the list.

clearback to summary
public void clear()

Empties the list. Note that this method does not shrink the size of the backing data store.

getback to summary
public int get(int index)

Returns the indexth int in the list.

Parameters
index:int

The list index of the desired int.

Returns:int

The int at index index in the list.

Exceptions
IndexOutOfBoundsException:
if the index is negative or greater than the number of ints stored in the list.
growback to summary
private void grow()

Reallocates the backing array to accommodate storing more ints.

isEmptyback to summary
public boolean isEmpty()
Returns:boolean

true if there are ints stored in the list.

sizeback to summary
public int size()

Accessor.

Returns:int

The number of ints currently stored in the list.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override