Package org.antlr.misc
Class IntArrayList
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
FieldsModifier and TypeFieldDescriptionprivate static final intprotected int[]protected intFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int o) intcapacity()clone()booleancontains(int v) intelement(int i) int[]elements()voidensureCapacity(int newCapacity) booleanget(int i) protected voidgrow()intset(int i, int newValue) Set the ith element.voidsetSize(int newSize) intsize()toString()Methods inherited from class java.util.AbstractList
add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
DEFAULT_CAPACITY
private static final int DEFAULT_CAPACITY- See Also:
-
n
protected int n -
elements
protected int[] elements
-
-
Constructor Details
-
IntArrayList
public IntArrayList() -
IntArrayList
public IntArrayList(int initialCapacity)
-
-
Method Details
-
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
-
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
- Specified by:
equalsin interfaceCollection<Integer>- Specified by:
equalsin interfaceList<Integer>- Overrides:
equalsin classAbstractList<Integer>
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
toString
- Overrides:
toStringin classAbstractCollection<Integer>
-