| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | ByteArrayList.
An iterator implementation for |
| Modifier and Type | Field and Description |
|---|---|
| public byte[] | 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 byte[] | EMPTY_ARRAY
An immutable empty buffer (array). |
| protected final ArraySizingStrategy | resizer
Buffer resizing strategy. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ByteArrayList(int
The expected number of elements guaranteed not to cause buffer
expansion (inclusive). expectedElements)New instance with sane defaults. |
| public | ByteArrayList(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 | ByteArrayList(ByteContainer container)
Creates a new list from the elements of another container in its iteration order. |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(byte e1)
Implements com. Adds an element to the end of this container (the last index is incremented by one). |
| public void | |
| public void | add(byte[] 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 ByteArrayList | |
| public boolean | contains(byte 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(ByteArrayList 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 ByteProcedure> T | forEach(T procedure)
Implements com. Applies a |
| public <T extends ByteProcedure> T | forEach(T procedure, int fromIndex, final int toIndex)
Applies |
| public <T extends BytePredicate> T | forEach(T predicate)
Implements com. Applies a |
| public <T extends BytePredicate> T | forEach(T predicate, int fromIndex, final int toIndex)
Applies |
| public static ByteArrayList | |
| public byte | |
| public int | |
| public int | indexOf(byte 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, byte 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(byte 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(byte
Element to be removed from this collection, if present. e1)Implements com. Removes all occurrences of |
| public int | removeAll(BytePredicate predicate)
Implements com. Removes all elements in this collection for which the given predicate returns |
| public byte | removeAt(int index)
Implements com. Removes the element at the specified position in this container and returns it. |
| public boolean | removeElement(byte e1)
Implements com. Removes the first element that equals |
| public int | removeFirst(byte e1)
Implements com. Removes the first element that equals |
| public byte | removeLast()
Implements com. Removes and returns the last element of this container. |
| public int | removeLast(byte 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 ByteIndexedContainer | reverse()
Implements com. Reverses the elements in this container and returns this container. |
| public byte | set(int index, byte 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 ByteIndexedContainer | sort()
Implements com. Sorts the elements in this container and returns this container. |
| public byte[] | toArray()
Overrides com. Implements com. Copies all elements of this container to an array. |
| public void |
| buffer | back to summary |
|---|---|
| public byte[] 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 byte[] EMPTY_ARRAY An immutable empty buffer (array). | |
| resizer | back to summary |
|---|---|
| protected final ArraySizingStrategy resizer Buffer resizing strategy. | |
| ByteArrayList | back to summary |
|---|---|
| public ByteArrayList() New instance with sane defaults. | |
| ByteArrayList | back to summary |
|---|---|
| public ByteArrayList(int expectedElements) New instance with sane defaults.
| |
| ByteArrayList | back to summary |
|---|---|
| public ByteArrayList(int expectedElements, ArraySizingStrategy resizer) New instance with sane defaults.
| |
| ByteArrayList | back to summary |
|---|---|
| public ByteArrayList(ByteContainer container) Creates a new list from the elements of another container in its iteration order. | |
| add | back to summary |
|---|---|
| public void add(byte 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(byte e1, byte e2) Appends two elements at the end of the list. To add more than two elements, use | |
| add | back to summary |
|---|---|
| public void add(byte[] 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(byte... 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(ByteContainer container) Adds all elements from another container. | |
| addAll | back to summary |
|---|---|
| public int addAll(Iterable<? extends ByteCursor> 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 ByteArrayList 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(byte 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(ByteArrayList 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 ByteProcedure> 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 ByteProcedure> T forEach(T procedure, int fromIndex, final int toIndex) Applies | |
| forEach | back to summary |
|---|---|
| public <T extends BytePredicate> 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 BytePredicate> T forEach(T predicate, int fromIndex, final int toIndex) Applies | |
| from | back to summary |
|---|---|
| public static ByteArrayList from(byte... elements) Create a list from a variable number of arguments or an array of | |
| get | back to summary |
|---|---|
| public byte 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(byte 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, byte 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 (ByteCursor<byte> c : container) {
System.out.println("index=" + c.index + " value=" + c.value);
}
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(byte 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(byte e1) Implements com. Doc from com. Removes all occurrences of
| |
| removeAll | back to summary |
|---|---|
| public int removeAll(BytePredicate predicate) Implements com. Doc from com. Removes all elements in this collection for which the given predicate returns
| |
| removeAt | back to summary |
|---|---|
| public byte 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(byte e1) Implements com. Doc from com. Removes the first element that equals
| |
| removeFirst | back to summary |
|---|---|
| public int removeFirst(byte e1) Implements com. Doc from com. Removes the first element that equals
| |
| removeLast | back to summary |
|---|---|
| public byte 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(byte 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 ByteIndexedContainer reverse() Implements com. Doc from com. Reverses the elements in this container and returns this container.
| |
| set | back to summary |
|---|---|
| public byte set(int index, byte 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 ByteIndexedContainer sort() Implements com. Doc from com. Sorts the elements in this container and returns this container.
| |
| toArray | back to summary |
|---|---|
| public byte[] 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. | |
ByteArrayList#iterator.
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private final ByteCursor | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ByteCursor |
| buffer | back to summary |
|---|---|
| private final byte[] buffer | |
| cursor | back to summary |
|---|---|
| private final ByteCursor cursor | |
| size | back to summary |
|---|---|
| private final int size | |
| ValueIterator | back to summary |
|---|---|
| public ValueIterator(byte[] buffer, int size) | |
| fetch | back to summary |
|---|---|
| protected ByteCursor fetch() Implements abstract com. Doc from com. Fetch next element. The implementation must return
| |