Top Description Fields Constructors Methods
org.antlr.stringtemplate.language

public Class ArrayWrappedInList

extends ArrayList
Class Inheritance
Imports
java.util.ArrayList, .Iterator, java.lang.reflect.Array

Turn an array into a List; subclass ArrayList for easy development, but it really doesn't use super stuff for anything. Ensure we create ArrayIterator for this List.

Field Summary

Modifier and TypeField and Description
protected Object
protected int
n

Arrays are fixed size; precompute.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
get(int
index of the element to return
i
)

Overrides java.util.ArrayList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.
public boolean
isEmpty()

Overrides java.util.ArrayList.isEmpty.

Implements java.util.List.isEmpty, java.util.Collection.isEmpty.

Returns true if this list contains no elements.
public Iterator<E>
iterator()

Overrides java.util.ArrayList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this list in proper sequence.
public int
size()

Overrides java.util.ArrayList.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.
public Object[]
toArray()

Overrides java.util.ArrayList.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).
Inherited from java.util.ArrayList:
addaddaddAlladdAlladdFirstaddLastclearclonecontainsensureCapacityequalsforEachgetFirstgetLasthashCodeindexOflastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsetsortspliteratorsubListtoArraytrimToSize

Field Detail

arrayback to summary
protected Object array
nback to summary
protected int n

Arrays are fixed size; precompute.

Constructor Detail

ArrayWrappedInListback to summary
public ArrayWrappedInList(Object array)

Method Detail

getback to summary
public Object get(int i)

Overrides java.util.ArrayList.get.

Implements java.util.List.get.

Doc from java.util.ArrayList.get.

Returns the element at the specified position in this list.

Parameters
i:int

index of the element to return

Returns:Object

the element at the specified position in this list

isEmptyback to summary
public boolean isEmpty()

Overrides java.util.ArrayList.isEmpty.

Implements java.util.List.isEmpty, java.util.Collection.isEmpty.

Doc from java.util.ArrayList.isEmpty.

Returns true if this list contains no elements.

Returns:boolean

true if this list contains no elements

iteratorback to summary
public Iterator<E> iterator()

Overrides java.util.ArrayList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Doc from java.util.ArrayList.iterator.

Returns an iterator over the elements in this list in proper sequence.

The returned iterator is fail-fast.

Returns:Iterator<E>

an iterator over the elements in this list in proper sequence

sizeback to summary
public int size()

Overrides java.util.ArrayList.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.ArrayList.size.

Returns the number of elements in this list.

Returns:int

the number of elements in this list

toArrayback to summary
public Object[] toArray()

Overrides java.util.ArrayList.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.ArrayList.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.

This method acts as bridge between array-based and collection-based APIs.

Returns:Object[]

an array containing all of the elements in this list in proper sequence