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