Top Description Fields Constructors Methods
org.antlr.misc

public Class IntArrayList

extends AbstractList<Integer>
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.util.AbstractList

An ArrayList based upon int members. Not quite a real implementation of a modifiable list as I don't do, for example, add(index,element).

Todo

unused?

Field Summary

Modifier and TypeField and Description
private static final int
protected int[]
protected int
n

Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
public
public
IntArrayList(int initialCapacity)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(int
element to be appended to this list
o
)

Overrides java.util.AbstractList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list (optional operation).
public int
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public boolean
contains(int v)

public int
element(int i)

public int[]
public void
ensureCapacity(int newCapacity)

public boolean
equals(Object
the object to be compared for equality with this list
o
)

Overrides java.util.AbstractList.equals.

Implements java.util.List.equals, java.util.Collection.equals.

Compares the specified object with this list for equality.
public Integer
get(int
index of the element to return
i
)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.
protected void
grow()

public int
set(int
index of the element to replace
i
,
int
element to be stored at the specified position
newValue
)

Overrides java.util.AbstractList.set.

Implements java.util.List.set.

Set the ith element.
public void
setSize(int newSize)

public int
size()

Implements abstract java.util.AbstractCollection.size.

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

Returns the number of elements in this list.
public String
toString()

Overrides java.util.AbstractCollection.toString.

Returns a string representation of this collection.
Inherited from java.util.AbstractList:
addaddAllclearhashCodeindexOfiteratorlastIndexOflistIteratorlistIteratorremoveremoveRangesubList

Field Detail

DEFAULT_CAPACITYback to summary
private static final int DEFAULT_CAPACITY
elementsback to summary
protected int[] elements
nback to summary
protected int n

Constructor Detail

IntArrayListback to summary
public IntArrayList()
IntArrayListback to summary
public IntArrayList(int initialCapacity)

Method Detail

addback to summary
public boolean add(int o)

Overrides java.util.AbstractList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.AbstractList.add.

Appends the specified element to the end of this list (optional operation).

Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.

Parameters
o:int

element to be appended to this list

Returns:boolean

true (as specified by Collection#add)

capacityback to summary
public int capacity()
cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
Exceptions
CloneNotSupportedException:
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
containsback to summary
public boolean contains(int v)
elementback to summary
public int element(int i)
elementsback to summary
public int[] elements()
ensureCapacityback to summary
public void ensureCapacity(int newCapacity)
equalsback to summary
public boolean equals(Object o)

Overrides java.util.AbstractList.equals.

Implements java.util.List.equals, java.util.Collection.equals.

Doc from java.util.AbstractList.equals.

Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order.

Parameters
o:Object

the object to be compared for equality with this list

Returns:boolean

true if the specified object is equal to this list

Annotations
@Override
getback to summary
public Integer get(int i)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Doc from java.util.AbstractList.get.

Returns the element at the specified position in this list.

Parameters
i:int

Doc from java.util.List.get.

index of the element to return

Returns:Integer

Doc from java.util.List.get.

the element at the specified position in this list

Annotations
@Override
growback to summary
protected void grow()
setback to summary
public int set(int i, int newValue)

Overrides java.util.AbstractList.set.

Implements java.util.List.set.

Set the ith element. Like ArrayList, this does NOT affect size.

Parameters
i:int

Doc from java.util.List.set.

index of the element to replace

newValue:int

Doc from java.util.List.set.

element to be stored at the specified position

Returns:int

Doc from java.util.List.set.

the element previously at the specified position

setSizeback to summary
public void setSize(int newSize)
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

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

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this list

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.AbstractCollection.toString.

Doc from java.util.AbstractCollection.toString.

Returns a string representation of this collection. The string representation consists of a list of the collection's elements in the order they are returned by its iterator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String#valueOf(Object).

Returns:String

a string representation of this collection

Annotations
@Override