Package org.antlr.misc
Class IntArrayList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<Integer>
-
- org.antlr.misc.IntArrayList
-
public class IntArrayList extends AbstractList<Integer> implements Cloneable
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
Fields Modifier and Type Field Description protected int[]
elements
protected int
n
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description IntArrayList()
IntArrayList(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(int o)
int
capacity()
Object
clone()
boolean
contains(int v)
int
element(int i)
int[]
elements()
void
ensureCapacity(int newCapacity)
boolean
equals(Object o)
Integer
get(int i)
protected void
grow()
int
set(int i, int newValue)
Set the ith element.void
setSize(int newSize)
int
size()
String
toString()
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
-
-
-
Method Detail
-
set
public int set(int i, int newValue)
Set the ith element. Like ArrayList, this does NOT affect size.
-
add
public boolean add(int o)
-
setSize
public void setSize(int newSize)
-
grow
protected void grow()
-
contains
public boolean contains(int v)
-
ensureCapacity
public void ensureCapacity(int newCapacity)
-
get
public Integer get(int i)
-
element
public int element(int i)
-
elements
public int[] elements()
-
size
public int size()
- Specified by:
size
in interfaceCollection<Integer>
- Specified by:
size
in interfaceList<Integer>
- Specified by:
size
in classAbstractCollection<Integer>
-
capacity
public int capacity()
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<Integer>
- Specified by:
equals
in interfaceList<Integer>
- Overrides:
equals
in classAbstractList<Integer>
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
toString
public String toString()
- Overrides:
toString
in classAbstractCollection<Integer>
-
-