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 int
protected int[]
protected int
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(int o) int
capacity()
clone()
boolean
contains
(int v) int
element
(int i) int[]
elements()
void
ensureCapacity
(int newCapacity) boolean
get
(int i) protected void
grow()
int
set
(int i, int newValue) Set the ith element.void
setSize
(int newSize) int
size()
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
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
-
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:
size
in interfaceCollection<Integer>
- Specified by:
size
in interfaceList<Integer>
- Specified by:
size
in classAbstractCollection<Integer>
-
capacity
public int capacity() -
equals
- Specified by:
equals
in interfaceCollection<Integer>
- Specified by:
equals
in interfaceList<Integer>
- Overrides:
equals
in classAbstractList<Integer>
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
toString
- Overrides:
toString
in classAbstractCollection<Integer>
-