| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | ShortArrayList.
An iterator implementation for |
| Modifier and Type | Field and Description |
|---|---|
| public short[] | buffer
Internal array for storing the list. |
| private static final BoundedProportionalArraySizingStrategy | DEFAULT_SIZING_STRATEGY
Reuse the same strategy instance. |
| public int | elementsCount
Current number of elements stored in |
| public static final short[] | EMPTY_ARRAY
An immutable empty buffer (array). |
| protected final ArraySizingStrategy | resizer
Buffer resizing strategy. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ShortArrayList(int
The expected number of elements guaranteed not to cause buffer
expansion (inclusive). expectedElements)New instance with sane defaults. |
| public | ShortArrayList(int
The expected number of elements guaranteed not to cause buffer
expansion (inclusive). expectedElements, ArraySizingStrategy Underlying buffer sizing strategy. resizer)New instance with sane defaults. |
| public | ShortArrayList(ShortContainer container)
Creates a new list from the elements of another container in its iteration order. |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(short e1)
Implements com. Adds an element to the end of this container (the last index is incremented by one). |
| public void | |
| public void | add(short[] elements, int start, int length)
Add all elements from a range of given array to the list. |
| public final void | |
| public int | |
| public int | |
| public void | clear()
Implements com. Sets the number of stored elements to zero. |
| public ShortArrayList | |
| public boolean | contains(short e1)
Implements com. Lookup a given element in the container. |
| protected void | ensureBufferSpace(int expectedAdditions)
Ensures the internal buffer has enough free slots to store |
| public void | ensureCapacity(int
The total number of elements, inclusive. expectedElements)Implements com. Ensure this container can hold at least the given number of elements without resizing its buffers. |
| protected boolean | equalElements(ShortArrayList other)
Compare index-aligned elements against another |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Returns |
| public <T extends ShortProcedure> T | forEach(T procedure)
Implements com. Applies a |
| public <T extends ShortProcedure> T | forEach(T procedure, int fromIndex, final int toIndex)
Applies |
| public <T extends ShortPredicate> T | forEach(T predicate)
Implements com. Applies a |
| public <T extends ShortPredicate> T | forEach(T predicate, int fromIndex, final int toIndex)
Applies |
| public static ShortArrayList | |
| public short | |
| public int | |
| public int | indexOf(short e1)
Implements com. Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. |
| public void | insert(int
The index at which the element should be inserted, shifting any existing and
subsequent elements to the right. index, short e1)Implements com. Inserts the specified element at the specified position in this list. |
| public boolean | |
| public Iterator | iterator()
Implements com. Returns an iterator to a cursor traversing the collection. |
| public int | lastIndexOf(short e1)
Implements com. Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. |
| public long | ramBytesAllocated()
Implements com. Allocated memory estimation |
| public long | ramBytesUsed()
Implements com. Bytes that is actually been used |
| public void | release()
Implements com. Sets the number of stored elements to zero and releases the internal storage array. |
| public int | removeAll(short
Element to be removed from this collection, if present. e1)Implements com. Removes all occurrences of |
| public int | removeAll(ShortPredicate predicate)
Implements com. Removes all elements in this collection for which the given predicate returns |
| public short | removeAt(int index)
Implements com. Removes the element at the specified position in this container and returns it. |
| public boolean | removeElement(short e1)
Implements com. Removes the first element that equals |
| public int | removeFirst(short e1)
Implements com. Removes the first element that equals |
| public short | removeLast()
Implements com. Removes and returns the last element of this container. |
| public int | removeLast(short e1)
Implements com. Removes the last element that equals |
| public void | removeRange(int fromIndex, int toIndex)
Implements com. Removes from this container all of the elements with indexes between |
| public void | |
| public ShortIndexedContainer | reverse()
Implements com. Reverses the elements in this container and returns this container. |
| public short | set(int index, short e1)
Implements com. Replaces the element at the specified position in this list with the specified element. |
| public int | size()
Implements com. Return the current number of elements in this container. |
| public ShortIndexedContainer | sort()
Implements com. Sorts the elements in this container and returns this container. |
| public short[] | toArray()
Overrides com. Implements com. Copies all elements of this container to an array. |
| public void |
| buffer | back to summary |
|---|---|
| public short[] buffer Internal array for storing the list. The array may be larger than the current size ( | |
| DEFAULT_SIZING_STRATEGY | back to summary |
|---|---|
| private static final BoundedProportionalArraySizingStrategy DEFAULT_SIZING_STRATEGY Reuse the same strategy instance. | |
| elementsCount | back to summary |
|---|---|
| public int elementsCount Current number of elements stored in | |
| EMPTY_ARRAY | back to summary |
|---|---|
| public static final short[] EMPTY_ARRAY An immutable empty buffer (array). | |
| resizer | back to summary |
|---|---|
| protected final ArraySizingStrategy resizer Buffer resizing strategy. | |
| ShortArrayList | back to summary |
|---|---|
| public ShortArrayList() New instance with sane defaults. | |
| ShortArrayList | back to summary |
|---|---|
| public ShortArrayList(int expectedElements) New instance with sane defaults.
| |
| ShortArrayList | back to summary |
|---|---|
| public ShortArrayList(int expectedElements, ArraySizingStrategy resizer) New instance with sane defaults.
| |
| ShortArrayList | back to summary |
|---|---|
| public ShortArrayList(ShortContainer container) Creates a new list from the elements of another container in its iteration order. | |
| add | back to summary |
|---|---|
| public void add(short e1) Implements com. Doc from com. Adds an element to the end of this container (the last index is incremented by one).
| |
| add | back to summary |
|---|---|
| public void add(short e1, short e2) Appends two elements at the end of the list. To add more than two elements, use | |
| add | back to summary |
|---|---|
| public void add(short[] elements, int start, int length) Add all elements from a range of given array to the list. | |
| add | back to summary |
|---|---|
| public final void add(short... elements) Vararg-signature method for adding elements at the end of the list. This method is handy, but costly if used in tight loops (anonymous array passing) | |
| addAll | back to summary |
|---|---|
| public int addAll(ShortContainer container) Adds all elements from another container. | |
| addAll | back to summary |
|---|---|
| public int addAll(Iterable<? extends ShortCursor> iterable) Adds all elements from another iterable. | |
| clear | back to summary |
|---|---|
| public void clear() Implements com. Sets the number of stored elements to zero. Releases and initializes the internal storage array
to default values. To clear the list without cleaning the buffer, simply set the
| |
| clone | back to summary |
|---|---|
| public ShortArrayList clone() Overrides java. Clone this object. The returned clone will reuse the same hash function and array resizing strategy.
| |
| contains | back to summary |
|---|---|
| public boolean contains(short e1) Implements com. Doc from com. Lookup a given element in the container. This operation has no speed guarantees (may be linear with respect to the size of this container).
| |
| ensureBufferSpace | back to summary |
|---|---|
| protected void ensureBufferSpace(int expectedAdditions) Ensures the internal buffer has enough free slots to store | |
| ensureCapacity | back to summary |
|---|---|
| public void ensureCapacity(int expectedElements) Implements com. Ensure this container can hold at least the given number of elements without resizing its buffers.
| |
| equalElements | back to summary |
|---|---|
| protected boolean equalElements(ShortArrayList other) Compare index-aligned elements against another | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Returns
| |
| forEach | back to summary |
|---|---|
| public <T extends ShortProcedure> T forEach(T procedure) Implements com. Doc from com. Applies a
int count = container.forEach(new IntProcedure() {
int count; // this is a field declaration in an anonymous class.
public void apply(int value) {
count++;
}
}).count;
| |
| forEach | back to summary |
|---|---|
| public <T extends ShortProcedure> T forEach(T procedure, int fromIndex, final int toIndex) Applies | |
| forEach | back to summary |
|---|---|
| public <T extends ShortPredicate> T forEach(T predicate) Implements com. Doc from com. Applies a
int count = container.forEach(new IntProcedure() {
int count; // this is a field declaration in an anonymous class.
public void apply(int value) {
count++;
}
}).count;
| |
| forEach | back to summary |
|---|---|
| public <T extends ShortPredicate> T forEach(T predicate, int fromIndex, final int toIndex) Applies | |
| from | back to summary |
|---|---|
| public static ShortArrayList from(short... elements) Create a list from a variable number of arguments or an array of | |
| get | back to summary |
|---|---|
| public short get(int index) Implements com.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(short e1) Implements com. Doc from com. Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
| |
| insert | back to summary |
|---|---|
| public void insert(int index, short e1) Implements com. Doc from com. Inserts the specified element at the specified position in this list.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements com. Doc from com. Shortcut for
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements com. Doc from com. Returns an iterator to a cursor traversing the collection. The order of traversal is not defined. More than one cursor may be active at a time. The behavior of iterators is undefined if structural changes are made to the underlying collection. The iterator is implemented as a cursor and it returns the same cursor instance on
every call to
for (ShortCursor<short> c : container) {
System.out.println("index=" + c.index + " value=" + c.value);
}
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(short e1) Implements com. Doc from com. Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
| |
| ramBytesAllocated | back to summary |
|---|---|
| public long ramBytesAllocated() Implements com. Doc from com. Allocated memory estimation
| |
| ramBytesUsed | back to summary |
|---|---|
| public long ramBytesUsed() Implements com. Doc from com. Bytes that is actually been used
| |
| release | back to summary |
|---|---|
| public void release() Implements com. Sets the number of stored elements to zero and releases the internal storage array.
| |
| removeAll | back to summary |
|---|---|
| public int removeAll(short e1) Implements com. Doc from com. Removes all occurrences of
| |
| removeAll | back to summary |
|---|---|
| public int removeAll(ShortPredicate predicate) Implements com. Doc from com. Removes all elements in this collection for which the given predicate returns
| |
| removeAt | back to summary |
|---|---|
| public short removeAt(int index) Implements com. Doc from com. Removes the element at the specified position in this container and returns it.
| |
| removeElement | back to summary |
|---|---|
| public boolean removeElement(short e1) Implements com. Doc from com. Removes the first element that equals
| |
| removeFirst | back to summary |
|---|---|
| public int removeFirst(short e1) Implements com. Doc from com. Removes the first element that equals
| |
| removeLast | back to summary |
|---|---|
| public short removeLast() Implements com. Doc from com. Removes and returns the last element of this container. This container must not be empty.
| |
| removeLast | back to summary |
|---|---|
| public int removeLast(short e1) Implements com. Doc from com. Removes the last element that equals
| |
| removeRange | back to summary |
|---|---|
| public void removeRange(int fromIndex, int toIndex) Implements com. Doc from com. Removes from this container all of the elements with indexes between
| |
| resize | back to summary |
|---|---|
| public void resize(int newSize) Truncate or expand the list to the new size. If the list is truncated, the buffer will not be
reallocated (use | |
| reverse | back to summary |
|---|---|
| public ShortIndexedContainer reverse() Implements com. Doc from com. Reverses the elements in this container and returns this container.
| |
| set | back to summary |
|---|---|
| public short set(int index, short e1) Implements com. Doc from com. Replaces the element at the specified position in this list with the specified element.
| |
| size | back to summary |
|---|---|
| public int size() Implements com. Doc from com. Return the current number of elements in this container. The time for calculating the
container's size may take
| |
| sort | back to summary |
|---|---|
| public ShortIndexedContainer sort() Implements com. Doc from com. Sorts the elements in this container and returns this container.
| |
| toArray | back to summary |
|---|---|
| public short[] toArray() Overrides com. Implements com. Doc from com. Copies all elements of this container to an array. The returned array is always a copy, regardless of the storage used by the container. The returned array is sized to match exactly the number of elements of the stack.
| |
| trimToSize | back to summary |
|---|---|
| public void trimToSize() Trim the internal buffer to the current size. | |
ShortArrayList#iterator.
| Modifier and Type | Field and Description |
|---|---|
| private final short[] | |
| private final ShortCursor | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ShortCursor |
| buffer | back to summary |
|---|---|
| private final short[] buffer | |
| cursor | back to summary |
|---|---|
| private final ShortCursor cursor | |
| size | back to summary |
|---|---|
| private final int size | |
| ValueIterator | back to summary |
|---|---|
| public ValueIterator(short[] buffer, int size) | |
| fetch | back to summary |
|---|---|
| protected ShortCursor fetch() Implements abstract com. Doc from com. Fetch next element. The implementation must return
| |