An array-backed list of int.
Mostly forked and trimmed from com.carrotsearch.hppc.IntArrayList
github: https://github.com/carrotsearch/hppc release 0.10.0
| constant | type | note |
|---|---|---|
| EMPTY_ARRAY | int[] | An immutable empty buffer (array). |
| field | type | note |
|---|---|---|
| buffer | int[] | Internal array for storing the list. The array may be larger than the current size (#size()). |
| elementsCount | int | Current number of elements stored in #buffer. |
<init>()New instance with sane defaults.
<init>(int expectedElements)New instance with sane defaults.
| name | type | description |
|---|---|---|
| expected_elements | int | The expected number of elements guaranteed not to cause buffer expansion (inclusive). |
Creates a new list from the elements of another list in its iteration order.
Create a list from a variable number of arguments or an array of int. The elements
are copied from the argument to the internal buffer.
add(int e1)add(int[] elements, int start, int length)Add all elements from a range of given array to the list.
add(int[] 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)
Adds all elements from another list.
addAll(Iterable<? extends org.apache.lucene.internal.hppc.IntCursor> iterable)Adds all elements from another iterable.
clear()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 #elementsCount field to zero.
Clone this object. The returned clone will reuse the same hash function and array resizing strategy.
contains(int e1)isEmpty() · also: is_emptyensureCapacity(int expectedElements)Ensure this container can hold at least the given number of elements without resizing its buffers.
| name | type | description |
|---|---|---|
| expected_elements | int | The total number of elements, inclusive. |
equals(Object obj)Returns true only if the other object is an instance of the same class and with
the same elements.
get(int index)hashCode()indexOf(int e1)insert(int index, int e1)lastIndexOf(int e1)ramBytesUsed()release()Sets the number of stored elements to zero and releases the internal storage array.
removeAll(int e)Removes all occurrences of e from this collection.
| name | type | description |
|---|---|---|
| e | int | Element to be removed from this collection, if present. |
Returns: The number of removed elements as a result of this call.
removeAt(int index)Removes the element at the specified position in this container and returns it.
removeElement(int e)Removes the first element that equals e, returning whether an element has been
removed.
removeFirst(int e1)Removes the first element that equals e1, returning its deleted position or
-1 if the element was not found.
removeLast()Removes and returns the last element of this list.
removeLast(int e1)Removes the last element that equals e1, returning its deleted position or
-1 if the element was not found.
removeRange(int fromIndex, int toIndex)Removes from this list all the elements with indexes between fromIndex, inclusive,
and toIndex, exclusive.
resize(int newSize)Truncate or expand the list to the new size. If the list is truncated, the buffer will not be
reallocated (use #trimToSize() if you need a truncated buffer), but the truncated
values will be reset to the default value (zero). If the list is expanded, the elements beyond
the current size are initialized with JVM-defaults (zero or null values).
Reverses the elements in this list and returns this list.
set(int index, int e1)size()stream()Returns a stream of all the elements contained in this list.
toArray()The returned array is sized to match exactly the number of elements of the stack.
toString()Convert the contents of this list to a human-friendly string.
trimToSize()Trim the internal buffer to the current size.
| field | type | note |
|---|---|---|
| NULL_ACCOUNTABLE | Accountable | An accountable that always returns 0 |
Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).
forEach(java.util.function.Consumer<? super T> arg0)spliterator()