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[]elementsprotected intn-
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 booleanadd(int o)intcapacity()Objectclone()booleancontains(int v)intelement(int i)int[]elements()voidensureCapacity(int newCapacity)booleanequals(Object o)Integerget(int i)protected voidgrow()intset(int i, int newValue)Set the ith element.voidsetSize(int newSize)intsize()StringtoString()-
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
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, 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:
sizein interfaceCollection<Integer>- Specified by:
sizein interfaceList<Integer>- Specified by:
sizein classAbstractCollection<Integer>
-
capacity
public int capacity()
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<Integer>- Specified by:
equalsin interfaceList<Integer>- Overrides:
equalsin classAbstractList<Integer>
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
toString
public String toString()
- Overrides:
toStringin classAbstractCollection<Integer>
-
-