DoubleDeque.
| Modifier and Type | Class and Description |
|---|---|
| private class | DoubleArrayDeque.
An iterator implementation for |
| private class | DoubleArrayDeque.
An iterator implementation for |
| Modifier and Type | Field and Description |
|---|---|
| public double[] | buffer
Internal array for storing elements of the deque. |
| private static final BoundedProportionalArraySizingStrategy | DEFAULT_SIZING_STRATEGY
Reuse the same strategy instance. |
| public int | head
The index of the element at the head of the deque or an arbitrary number equal to tail if the deque is empty. |
| protected final ArraySizingStrategy | resizer
Buffer resizing strategy. |
| public int | tail
The index at which the next element would be added to the tail of the deque. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | DoubleArrayDeque(int
The expected number of elements guaranteed not to cause buffer
expansion (inclusive). expectedElements)New instance with sane defaults. |
| public | DoubleArrayDeque(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 | DoubleArrayDeque(DoubleContainer container)
Creates a new deque from elements of another container, appending elements at the end of the deque in the iteration order. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addFirst(double e1)
Implements com. Inserts the specified element at the front of this deque. |
| public final void | addFirst(double...
The elements to add. elements)Vararg-signature method for adding elements at the front of this deque. |
| public int | Returns: Returns the number of elements actually added as a result of this call.The container to iterate over. container)Inserts all elements from the given container to the front of this deque. |
| public int | Returns: Returns the number of elements actually added as a result of this call.The iterable to iterate over. iterable)Inserts all elements from the given iterable to the front of this deque. |
| public void | addLast(double e1)
Implements com. Inserts the specified element at the end of this deque. |
| public final void | addLast(double...
The elements to iterate over. elements)Vararg-signature method for adding elements at the end of this deque. |
| public int | Returns: Returns the number of elements actually added as a result of this call.The container to iterate over. container)Inserts all elements from the given container to the end of this deque. |
| public int | Returns: Returns the number of elements actually added as a result of this call.The iterable to iterate over. iterable)Inserts all elements from the given iterable to the end of this deque. |
| public int | Returns: Returns the index of the first element equal toe1 or -1 if
not found.The element to look for. e1)Return the index of the first (counting from head) element equal to |
| public void | clear()
Implements com. Removes all elements from this collection. |
| public DoubleArrayDeque | |
| public boolean | contains(double e)
Implements com. Lookup a given element in the container. |
| public <T extends DoubleProcedure> T | descendingForEach(T procedure)
Implements com. Applies |
| private void | descendingForEach(DoubleProcedure procedure, int fromIndex, final int toIndex)
Applies |
| public <T extends DoublePredicate> T | descendingForEach(T predicate)
Implements com. Applies a |
| private void | descendingForEach(DoublePredicate predicate, int fromIndex, final int toIndex)
Applies |
| public Iterator | descendingIterator()
Implements com. Returns a cursor over the values of this deque (in tail to head order). |
| 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 | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Returns |
| public <T extends DoubleProcedure> T | forEach(T procedure)
Implements com. Applies a |
| private void | forEach(DoubleProcedure procedure, int fromIndex, final int toIndex)
Applies |
| public <T extends DoublePredicate> T | forEach(T predicate)
Implements com. Applies a |
| public static DoubleArrayDeque | from(double... elements)
Create a new deque by pushing a variable number of arguments to the end of it. |
| public double | getFirst()
Implements com. Retrieves the first element of this deque but does not remove it. |
| public double | getLast()
Implements com. Retrieves the last element of this deque but does not remove it. |
| public int | |
| public boolean | |
| public Iterator | iterator()
Implements com. Returns a cursor over the values of this deque (in head to tail order). |
| public int | Returns: Returns the index of the first element equal toe1 or -1 if
not found.The element to look for. e1)Return the index of the last (counting from tail) element equal to |
| protected static int | |
| protected static int | |
| public long | ramBytesAllocated()
Implements com. Allocated memory estimation |
| public long | ramBytesUsed()
Implements com. Bytes that is actually been used |
| public void | release()
Implements com. Release internal buffers of this deque and reallocate with the default buffer. |
| public int | removeAll(double
Element to be removed from this collection, if present. e1)Implements com. Removes all occurrences of |
| public int | removeAll(DoublePredicate predicate)
Implements com. Removes all elements in this collection for which the given predicate returns |
| public void | removeAtBufferIndex(int index)
Removes the element at |
| public double | removeFirst()
Implements com. Retrieves and removes the first element of this deque. |
| public int | removeFirst(double e1)
Implements com. Removes the first element that equals |
| public double | removeLast()
Implements com. Retrieves and removes the last element of this deque. |
| public int | removeLast(double e1)
Implements com. Removes the last element that equals |
| public int | size()
Implements com. Return the current number of elements in this container. |
| public double[] | toArray()
Overrides com. Implements com. Copies all elements of this container to an array. |
| public double[] | Returns: Returns the target argument for chaining.The target array must be large enough to hold all elements. target)Copies elements of this deque to an array. |
| buffer | back to summary |
|---|---|
| public double[] buffer Internal array for storing elements of the deque. | |
| DEFAULT_SIZING_STRATEGY | back to summary |
|---|---|
| private static final BoundedProportionalArraySizingStrategy DEFAULT_SIZING_STRATEGY Reuse the same strategy instance. | |
| head | back to summary |
|---|---|
| public int head The index of the element at the head of the deque or an arbitrary number equal to tail if the deque is empty. | |
| resizer | back to summary |
|---|---|
| protected final ArraySizingStrategy resizer Buffer resizing strategy. | |
| tail | back to summary |
|---|---|
| public int tail The index at which the next element would be added to the tail of the deque. | |
| DoubleArrayDeque | back to summary |
|---|---|
| public DoubleArrayDeque() New instance with sane defaults. | |
| DoubleArrayDeque | back to summary |
|---|---|
| public DoubleArrayDeque(int expectedElements) New instance with sane defaults.
| |
| DoubleArrayDeque | back to summary |
|---|---|
| public DoubleArrayDeque(int expectedElements, ArraySizingStrategy resizer) New instance with sane defaults.
| |
| DoubleArrayDeque | back to summary |
|---|---|
| public DoubleArrayDeque(DoubleContainer container) Creates a new deque from elements of another container, appending elements at the end of the deque in the iteration order. | |
| addFirst | back to summary |
|---|---|
| public void addFirst(double e1) Implements com. Doc from com. Inserts the specified element at the front of this deque.
| |
| addFirst | back to summary |
|---|---|
| public final void addFirst(double... elements) Vararg-signature method for adding elements at the front of this deque. This method is handy, but costly if used in tight loops (anonymous array passing)
| |
| addFirst | back to summary |
|---|---|
| public int addFirst(DoubleContainer container) Inserts all elements from the given container to the front of this deque.
| |
| addFirst | back to summary |
|---|---|
| public int addFirst(Iterable<? extends DoubleCursor> iterable) Inserts all elements from the given iterable to the front of this deque.
| |
| addLast | back to summary |
|---|---|
| public void addLast(double e1) Implements com. Doc from com. Inserts the specified element at the end of this deque.
| |
| addLast | back to summary |
|---|---|
| public final void addLast(double... elements) Vararg-signature method for adding elements at the end of this deque. This method is handy, but costly if used in tight loops (anonymous array passing)
| |
| addLast | back to summary |
|---|---|
| public int addLast(DoubleContainer container) Inserts all elements from the given container to the end of this deque.
| |
| addLast | back to summary |
|---|---|
| public int addLast(Iterable<? extends DoubleCursor> iterable) Inserts all elements from the given iterable to the end of this deque.
| |
| bufferIndexOf | back to summary |
|---|---|
| public int bufferIndexOf(double e1) Return the index of the first (counting from head) element equal to
| |
| clear | back to summary |
|---|---|
| public void clear() Implements com. Doc from com. Removes all elements from this collection. The internal array buffers are not released as a result of this call. | |
| clone | back to summary |
|---|---|
| public DoubleArrayDeque 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(double e) 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).
| |
| descendingForEach | back to summary |
|---|---|
| public <T extends DoubleProcedure> T descendingForEach(T procedure) Implements com. Applies
| |
| descendingForEach | back to summary |
|---|---|
| private void descendingForEach(DoubleProcedure procedure, int fromIndex, final int toIndex) Applies | |
| descendingForEach | back to summary |
|---|---|
| public <T extends DoublePredicate> T descendingForEach(T predicate) Implements com. Doc from com. Applies a
| |
| descendingForEach | back to summary |
|---|---|
| private void descendingForEach(DoublePredicate predicate, int fromIndex, final int toIndex) Applies | |
| descendingIterator | back to summary |
|---|---|
| public Iterator Implements com. Returns a cursor over the values of this deque (in tail to head order). The iterator is
implemented as a cursor and it returns the same cursor instance on every call to
for (Iterator<IntCursor> i = intDeque.descendingIterator(); i.hasNext();) {
final IntCursor c = i.next();
System.out.println("buffer index=" + c.index + " value=" + c.value);
}
| |
| 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(DoubleArrayDeque other) Compare order-aligned elements against another | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Returns
| |
| forEach | back to summary |
|---|---|
| public <T extends DoubleProcedure> 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 |
|---|---|
| private void forEach(DoubleProcedure procedure, int fromIndex, final int toIndex) Applies | |
| forEach | back to summary |
|---|---|
| public <T extends DoublePredicate> 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;
| |
| from | back to summary |
|---|---|
| public static DoubleArrayDeque from(double... elements) Create a new deque by pushing a variable number of arguments to the end of it. | |
| getFirst | back to summary |
|---|---|
| public double getFirst() Implements com. Doc from com. Retrieves the first element of this deque but does not remove it.
| |
| getLast | back to summary |
|---|---|
| public double getLast() Implements com. Doc from com. Retrieves the last element of this deque but does not remove it.
| |
| 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
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements com. Doc from com. Shortcut for
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements com. Returns a cursor over the values of this deque (in head to tail order). The iterator is
implemented as a cursor and it returns the same cursor instance on every call to
for (IntValueCursor c : intDeque) {
System.out.println("buffer index=" + c.index + " value=" + c.value);
}
| |
| lastBufferIndexOf | back to summary |
|---|---|
| public int lastBufferIndexOf(double e1) Return the index of the last (counting from tail) element equal to
| |
| oneLeft | back to summary |
|---|---|
| protected static int oneLeft(int index, int modulus) Move one index to the left, wrapping around buffer. | |
| oneRight | back to summary |
|---|---|
| protected static int oneRight(int index, int modulus) Move one index to the right, wrapping around buffer. | |
| 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. Release internal buffers of this deque and reallocate with the default buffer. | |
| removeAll | back to summary |
|---|---|
| public int removeAll(double e1) Implements com. Doc from com. Removes all occurrences of
| |
| removeAll | back to summary |
|---|---|
| public int removeAll(DoublePredicate predicate) Implements com. Doc from com. Removes all elements in this collection for which the given predicate returns
| |
| removeAtBufferIndex | back to summary |
|---|---|
| public void removeAtBufferIndex(int index) Removes the element at | |
| removeFirst | back to summary |
|---|---|
| public double removeFirst() Implements com. Doc from com. Retrieves and removes the first element of this deque.
| |
| removeFirst | back to summary |
|---|---|
| public int removeFirst(double e1) Implements com. Doc from com. Removes the first element that equals
| |
| removeLast | back to summary |
|---|---|
| public double removeLast() Implements com. Doc from com. Retrieves and removes the last element of this deque.
| |
| removeLast | back to summary |
|---|---|
| public int removeLast(double e1) Implements com. Doc from com. Removes the last element that equals
| |
| 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
| |
| toArray | back to summary |
|---|---|
| public double[] 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.
| |
| toArray | back to summary |
|---|---|
| public double[] toArray(double[] target) Copies elements of this deque to an array. The content of the
| |
ObjectArrayDeque#descendingIterator().
| Modifier and Type | Field and Description |
|---|---|
| private final DoubleCursor | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected DoubleCursor |
| cursor | back to summary |
|---|---|
| private final DoubleCursor cursor | |
| remaining | back to summary |
|---|---|
| private int remaining | |
| DescendingValueIterator | back to summary |
|---|---|
| public DescendingValueIterator() | |
| fetch | back to summary |
|---|---|
| protected DoubleCursor fetch() Implements abstract com. Doc from com. Fetch next element. The implementation must return
| |
ObjectArrayDeque#iterator.
| Modifier and Type | Field and Description |
|---|---|
| private final DoubleCursor | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected DoubleCursor |
| cursor | back to summary |
|---|---|
| private final DoubleCursor cursor | |
| remaining | back to summary |
|---|---|
| private int remaining | |
| ValueIterator | back to summary |
|---|---|
| public ValueIterator() | |
| fetch | back to summary |
|---|---|
| protected DoubleCursor fetch() Implements abstract com. Doc from com. Fetch next element. The implementation must return
| |