Top Description Inners Fields Constructors Methods
com.carrotsearch.hppc

public Class ObjectArrayDeque<KType>

extends AbstractObjectCollection<KType>
implements ObjectDeque<KType>, Preallocable, Cloneable, Accountable
Class Inheritance
All Implemented Interfaces
com.carrotsearch.hppc.Accountable, java.lang.Cloneable, com.carrotsearch.hppc.Preallocable, com.carrotsearch.hppc.ObjectDeque, com.carrotsearch.hppc.ObjectCollection, com.carrotsearch.hppc.ObjectContainer, java.lang.Iterable
Annotations
@SuppressWarnings:unchecked
@Generated:KTypeArrayDeque.java
date:2024-06-04T15:20:17+0200
Static Imports
com.carrotsearch.hppc.Containers.*

An array-backed ObjectDeque.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
public Object[]
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.

Constructor Summary

AccessConstructor and Description
public
ObjectArrayDeque()

New instance with sane defaults.

public
ObjectArrayDeque(int
The expected number of elements guaranteed not to cause buffer expansion (inclusive).
expectedElements
)

New instance with sane defaults.

public
ObjectArrayDeque(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
ObjectArrayDeque(ObjectContainer<? extends KType> container)

Creates a new deque from elements of another container, appending elements at the end of the deque in the iteration order.

Method Summary

Modifier and TypeMethod and Description
public void
addFirst(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

Inserts the specified element at the front of this deque.

public final void
addFirst(KType...
The elements to add.
elements
)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

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.
addFirst
(ObjectContainer<? extends KType>
The container to iterate over.
container
)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

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.
addFirst
(Iterable<? extends ObjectCursor<? extends KType>>
The iterable to iterate over.
iterable
)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

Inserts all elements from the given iterable to the front of this deque.

public void
addLast(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

Inserts the specified element at the end of this deque.

public final void
addLast(KType...
The elements to iterate over.
elements
)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

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.
addLast
(ObjectContainer<? extends KType>
The container to iterate over.
container
)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

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.
addLast
(Iterable<? extends ObjectCursor<? extends KType>>
The iterable to iterate over.
iterable
)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

Inserts all elements from the given iterable to the end of this deque.

public int

Returns:

Returns the index of the first element equal to e1 or -1 if not found.
bufferIndexOf
(KType
The element to look for.
e1
)

Return the index of the first (counting from head) element equal to e1.

public void
clear()

Implements com.carrotsearch.hppc.ObjectCollection.clear.

Removes all elements from this collection.

public ObjectArrayDeque<KType>
clone()

Overrides java.lang.Object.clone.

Clone this object.

public boolean
contains(KType e)

Implements com.carrotsearch.hppc.ObjectContainer.contains.

Lookup a given element in the container.

public <T extends ObjectProcedure<? super KType>> T
descendingForEach(T procedure)

Implements com.carrotsearch.hppc.ObjectDeque.descendingForEach, com.carrotsearch.hppc.ObjectDeque.descendingForEach.

Applies procedure to all elements of this deque, tail to head.

private void
descendingForEach(ObjectProcedure<? super KType> procedure, int fromIndex, final int toIndex)

Applies procedure to a slice of the deque, toIndex, exclusive, down to fromIndex, inclusive.

public <T extends ObjectPredicate<? super KType>> T
descendingForEach(T predicate)

Implements com.carrotsearch.hppc.ObjectDeque.descendingForEach, com.carrotsearch.hppc.ObjectDeque.descendingForEach.

Applies a procedure to all elements in tail-to-head order.

private void
descendingForEach(ObjectPredicate<? super KType> predicate, int fromIndex, final int toIndex)

Applies predicate to a slice of the deque, toIndex, exclusive, down to fromIndex, inclusive or until the predicate returns false.

public Iterator<ObjectCursor<KType>>
descendingIterator()

Implements com.carrotsearch.hppc.ObjectDeque.descendingIterator.

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 expectedAdditions.

public void
ensureCapacity(int
The total number of elements, inclusive.
expectedElements
)

Implements com.carrotsearch.hppc.Preallocable.ensureCapacity.

Ensure this container can hold at least the given number of elements without resizing its buffers.

protected boolean
equalElements(ObjectArrayDeque<?> other)

Compare order-aligned elements against another ObjectDeque.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Returns true only if the other object is an instance of the same class and with the same elements.

public <T extends ObjectProcedure<? super KType>> T
forEach(T procedure)

Implements com.carrotsearch.hppc.ObjectContainer.forEach, com.carrotsearch.hppc.ObjectContainer.forEach.

Applies a procedure to all container elements.

private void
forEach(ObjectProcedure<? super KType> procedure, int fromIndex, final int toIndex)

Applies procedure to a slice of the deque, fromIndex, inclusive, to toIndex, exclusive.

public <T extends ObjectPredicate<? super KType>> T
forEach(T predicate)

Implements com.carrotsearch.hppc.ObjectContainer.forEach, com.carrotsearch.hppc.ObjectContainer.forEach.

Applies a procedure to all container elements.

public static <KType> ObjectArrayDeque<KType>
from(KType... elements)

Create a new deque by pushing a variable number of arguments to the end of it.

public KType
getFirst()

Implements com.carrotsearch.hppc.ObjectDeque.getFirst.

Retrieves the first element of this deque but does not remove it.

public KType
getLast()

Implements com.carrotsearch.hppc.ObjectDeque.getLast.

Retrieves the last element of this deque but does not remove it.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isEmpty()

Implements com.carrotsearch.hppc.ObjectContainer.isEmpty.

Shortcut for size() == 0.

public Iterator<ObjectCursor<KType>>
iterator()

Implements com.carrotsearch.hppc.ObjectContainer.iterator.

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 to e1 or -1 if not found.
lastBufferIndexOf
(KType
The element to look for.
e1
)

Return the index of the last (counting from tail) element equal to e1.

protected static int
oneLeft(int index, int modulus)

Move one index to the left, wrapping around buffer.

protected static int
oneRight(int index, int modulus)

Move one index to the right, wrapping around buffer.

public long
public long
ramBytesUsed()

Implements com.carrotsearch.hppc.Accountable.ramBytesUsed.

Bytes that is actually been used

public void
release()

Implements com.carrotsearch.hppc.ObjectCollection.release.

Release internal buffers of this deque and reallocate with the default buffer.

public int
removeAll(KType
Element to be removed from this collection, if present.
e1
)

Implements com.carrotsearch.hppc.ObjectCollection.removeAll.

Removes all occurrences of e from this collection.

public int
removeAll(ObjectPredicate<? super KType> predicate)

Implements com.carrotsearch.hppc.ObjectCollection.removeAll, com.carrotsearch.hppc.ObjectCollection.removeAll.

Removes all elements in this collection for which the given predicate returns true .

public void
removeAtBufferIndex(int
Index of the element to remove. The index must be located between head and tail in modulo buffer arithmetic.
index
)

Removes the element at index in the internal {#link buffer array, returning its value.

public KType
removeFirst()

Implements com.carrotsearch.hppc.ObjectDeque.removeFirst.

Retrieves and removes the first element of this deque.

public int
removeFirst(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.removeFirst.

Removes the first element that equals e.

public KType
removeLast()

Implements com.carrotsearch.hppc.ObjectDeque.removeLast.

Retrieves and removes the last element of this deque.

public int
removeLast(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.removeLast.

Removes the last element that equals e.

public int
size()

Implements com.carrotsearch.hppc.ObjectContainer.size.

Return the current number of elements in this container.

public Object[]
toArray()

Overrides com.carrotsearch.hppc.AbstractObjectCollection.toArray.

Implements com.carrotsearch.hppc.ObjectContainer.toArray.

Copies all elements of this container to an array.

public KType[]

Returns:

Returns the target argument for chaining.
toArray
(KType[]
The target array must be large enough to hold all elements.
target
)

Copies elements of this deque to an array.

Inherited from com.carrotsearch.hppc.AbstractObjectCollection:
equalsremoveAllretainAllretainAlltoArraytoString

Field Detail

bufferback to summary
public Object[] buffer

Internal array for storing elements of the deque.

DEFAULT_SIZING_STRATEGYback to summary
private static final BoundedProportionalArraySizingStrategy DEFAULT_SIZING_STRATEGY

Reuse the same strategy instance.

resizerback to summary
protected final ArraySizingStrategy resizer

Buffer resizing strategy.

tailback to summary
public int tail

The index at which the next element would be added to the tail of the deque.

Constructor Detail

ObjectArrayDequeback to summary
public ObjectArrayDeque()

New instance with sane defaults.

ObjectArrayDequeback to summary
public ObjectArrayDeque(int expectedElements)

New instance with sane defaults.

Parameters
expectedElements:int

The expected number of elements guaranteed not to cause buffer expansion (inclusive).

ObjectArrayDequeback to summary
public ObjectArrayDeque(int expectedElements, ArraySizingStrategy resizer)

New instance with sane defaults.

Parameters
expectedElements:int

The expected number of elements guaranteed not to cause buffer expansion (inclusive).

resizer:ArraySizingStrategy

Underlying buffer sizing strategy.

ObjectArrayDequeback to summary
public ObjectArrayDeque(ObjectContainer<? extends KType> container)

Creates a new deque from elements of another container, appending elements at the end of the deque in the iteration order.

Method Detail

addFirstback to summary
public void addFirst(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

Doc from com.carrotsearch.hppc.ObjectDeque.addFirst.

Inserts the specified element at the front of this deque.

Annotations
@Override
addFirstback to summary
public final void addFirst(KType... elements)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

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)

Parameters
elements:KType[]

The elements to add.

Annotations
@SafeVarargs
addFirstback to summary
public int addFirst(ObjectContainer<? extends KType> container)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

Inserts all elements from the given container to the front of this deque.

Parameters
container:ObjectContainer<? extends KType>

The container to iterate over.

Returns:int

Returns the number of elements actually added as a result of this call.

addFirstback to summary
public int addFirst(Iterable<? extends ObjectCursor<? extends KType>> iterable)

Implements com.carrotsearch.hppc.ObjectDeque.addFirst.

Inserts all elements from the given iterable to the front of this deque.

Parameters
iterable:Iterable<? extends ObjectCursor<? extends KType>>

The iterable to iterate over.

Returns:int

Returns the number of elements actually added as a result of this call.

addLastback to summary
public void addLast(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

Doc from com.carrotsearch.hppc.ObjectDeque.addLast.

Inserts the specified element at the end of this deque.

Annotations
@Override
addLastback to summary
public final void addLast(KType... elements)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

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)

Parameters
elements:KType[]

The elements to iterate over.

Annotations
@SafeVarargs
addLastback to summary
public int addLast(ObjectContainer<? extends KType> container)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

Inserts all elements from the given container to the end of this deque.

Parameters
container:ObjectContainer<? extends KType>

The container to iterate over.

Returns:int

Returns the number of elements actually added as a result of this call.

addLastback to summary
public int addLast(Iterable<? extends ObjectCursor<? extends KType>> iterable)

Implements com.carrotsearch.hppc.ObjectDeque.addLast.

Inserts all elements from the given iterable to the end of this deque.

Parameters
iterable:Iterable<? extends ObjectCursor<? extends KType>>

The iterable to iterate over.

Returns:int

Returns the number of elements actually added as a result of this call.

bufferIndexOfback to summary
public int bufferIndexOf(KType e1)

Return the index of the first (counting from head) element equal to e1. The index points to the buffer array.

Parameters
e1:KType

The element to look for.

Returns:int

Returns the index of the first element equal to e1 or -1 if not found.

clearback to summary
public void clear()

Implements com.carrotsearch.hppc.ObjectCollection.clear.

Doc from com.carrotsearch.hppc.ObjectCollection.clear.

Removes all elements from this collection.

The internal array buffers are not released as a result of this call.

Annotations
@Override
See Also
release()
cloneback to summary
public ObjectArrayDeque<KType> clone()

Overrides java.lang.Object.clone.

Clone this object. The returned clone will reuse the same hash function and array resizing strategy.

Returns:ObjectArrayDeque<KType>

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
containsback to summary
public boolean contains(KType e)

Implements com.carrotsearch.hppc.ObjectContainer.contains.

Doc from com.carrotsearch.hppc.ObjectContainer.contains.

Lookup a given element in the container. This operation has no speed guarantees (may be linear with respect to the size of this container).

Returns:boolean

Returns true if this container has an element equal to e.

Annotations
@Override
descendingForEachback to summary
public <T extends ObjectProcedure<? super KType>> T descendingForEach(T procedure)

Implements com.carrotsearch.hppc.ObjectDeque.descendingForEach, com.carrotsearch.hppc.ObjectDeque.descendingForEach.

Applies procedure to all elements of this deque, tail to head.

Annotations
@Override
descendingForEachback to summary
private void descendingForEach(ObjectProcedure<? super KType> procedure, int fromIndex, final int toIndex)

Applies procedure to a slice of the deque, toIndex, exclusive, down to fromIndex, inclusive.

descendingForEachback to summary
public <T extends ObjectPredicate<? super KType>> T descendingForEach(T predicate)

Implements com.carrotsearch.hppc.ObjectDeque.descendingForEach, com.carrotsearch.hppc.ObjectDeque.descendingForEach.

Doc from com.carrotsearch.hppc.ObjectDeque.descendingForEach.

Applies a procedure to all elements in tail-to-head order.

Annotations
@Override
descendingForEachback to summary
private void descendingForEach(ObjectPredicate<? super KType> predicate, int fromIndex, final int toIndex)

Applies predicate to a slice of the deque, toIndex, exclusive, down to fromIndex, inclusive or until the predicate returns false.

descendingIteratorback to summary
public Iterator<ObjectCursor<KType>> descendingIterator()

Implements com.carrotsearch.hppc.ObjectDeque.descendingIterator.

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 Iterator#next() (to avoid boxing of primitive types). To read the current value (or index in the deque's buffer) use the cursor's public fields. An example is shown below.

for (Iterator<IntCursor> i = intDeque.descendingIterator(); i.hasNext();) {
  final IntCursor c = i.next();
  System.out.println("buffer index=" + c.index + " value=" + c.value);
}
Returns:Iterator<ObjectCursor<KType>>

Doc from com.carrotsearch.hppc.ObjectDeque.descendingIterator.

An iterator over elements in this deque in tail-to-head order.

ensureBufferSpaceback to summary
protected void ensureBufferSpace(int expectedAdditions)

Ensures the internal buffer has enough free slots to store expectedAdditions. Increases internal buffer size if needed.

ensureCapacityback to summary
public void ensureCapacity(int expectedElements)

Implements com.carrotsearch.hppc.Preallocable.ensureCapacity.

Ensure this container can hold at least the given number of elements without resizing its buffers.

Parameters
expectedElements:int

The total number of elements, inclusive.

Annotations
@Override
equalElementsback to summary
protected boolean equalElements(ObjectArrayDeque<?> other)

Compare order-aligned elements against another ObjectDeque. Equality comparison is performed with this object's equals(Object, Object) method.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Returns true only if the other object is an instance of the same class and with the same elements. Equality comparison is performed with this object's equals(Object, Object) method.

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
forEachback to summary
public <T extends ObjectProcedure<? super KType>> T forEach(T procedure)

Implements com.carrotsearch.hppc.ObjectContainer.forEach, com.carrotsearch.hppc.ObjectContainer.forEach.

Doc from com.carrotsearch.hppc.ObjectContainer.forEach.

Applies a procedure to all container elements. Returns the argument (any subclass of ObjectProcedure. This lets the caller to call methods of the argument by chaining the call (even if the argument is an anonymous type) to retrieve computed values, for example (IntContainer):

int count = container.forEach(new IntProcedure() {
  int count; // this is a field declaration in an anonymous class.

  public void apply(int value) {
    count++;
  }
}).count;
Annotations
@Override
forEachback to summary
private void forEach(ObjectProcedure<? super KType> procedure, int fromIndex, final int toIndex)

Applies procedure to a slice of the deque, fromIndex, inclusive, to toIndex, exclusive.

forEachback to summary
public <T extends ObjectPredicate<? super KType>> T forEach(T predicate)

Implements com.carrotsearch.hppc.ObjectContainer.forEach, com.carrotsearch.hppc.ObjectContainer.forEach.

Doc from com.carrotsearch.hppc.ObjectContainer.forEach.

Applies a procedure to all container elements. Returns the argument (any subclass of ObjectProcedure. This lets the caller to call methods of the argument by chaining the call (even if the argument is an anonymous type) to retrieve computed values, for example (IntContainer):

int count = container.forEach(new IntProcedure() {
  int count; // this is a field declaration in an anonymous class.

  public void apply(int value) {
    count++;
  }
}).count;
Annotations
@Override
fromback to summary
public static <KType> ObjectArrayDeque<KType> from(KType... elements)

Create a new deque by pushing a variable number of arguments to the end of it.

Annotations
@SafeVarargs
getFirstback to summary
public KType getFirst()

Implements com.carrotsearch.hppc.ObjectDeque.getFirst.

Doc from com.carrotsearch.hppc.ObjectDeque.getFirst.

Retrieves the first element of this deque but does not remove it.

Returns:KType

the head of this deque.

Annotations
@Override
getLastback to summary
public KType getLast()

Implements com.carrotsearch.hppc.ObjectDeque.getLast.

Doc from com.carrotsearch.hppc.ObjectDeque.getLast.

Retrieves the last element of this deque but does not remove it.

Returns:KType

the head of this deque.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements com.carrotsearch.hppc.ObjectContainer.isEmpty.

Doc from com.carrotsearch.hppc.ObjectContainer.isEmpty.

Shortcut for size() == 0.

Annotations
@Override
iteratorback to summary
public Iterator<ObjectCursor<KType>> iterator()

Implements com.carrotsearch.hppc.ObjectContainer.iterator.

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 Iterator#next() (to avoid boxing of primitive types). To read the current value (or index in the deque's buffer) use the cursor's public fields. An example is shown below.

for (IntValueCursor c : intDeque) {
  System.out.println("buffer index=" + c.index + " value=" + c.value);
}
Returns:Iterator<ObjectCursor<KType>>

Doc from java.lang.Iterable.iterator.

an Iterator.

lastBufferIndexOfback to summary
public int lastBufferIndexOf(KType e1)

Return the index of the last (counting from tail) element equal to e1. The index points to the buffer array.

Parameters
e1:KType

The element to look for.

Returns:int

Returns the index of the first element equal to e1 or -1 if not found.

oneLeftback to summary
protected static int oneLeft(int index, int modulus)

Move one index to the left, wrapping around buffer.

oneRightback to summary
protected static int oneRight(int index, int modulus)

Move one index to the right, wrapping around buffer.

ramBytesAllocatedback to summary
public long ramBytesAllocated()

Implements com.carrotsearch.hppc.Accountable.ramBytesAllocated.

Doc from com.carrotsearch.hppc.Accountable.ramBytesAllocated.

Allocated memory estimation

Returns:long

Ram allocated in bytes

Annotations
@Override
ramBytesUsedback to summary
public long ramBytesUsed()

Implements com.carrotsearch.hppc.Accountable.ramBytesUsed.

Doc from com.carrotsearch.hppc.Accountable.ramBytesUsed.

Bytes that is actually been used

Returns:long

Ram used in bytes

Annotations
@Override
releaseback to summary
public void release()

Implements com.carrotsearch.hppc.ObjectCollection.release.

Release internal buffers of this deque and reallocate with the default buffer.

removeAllback to summary
public int removeAll(KType e1)

Implements com.carrotsearch.hppc.ObjectCollection.removeAll.

Doc from com.carrotsearch.hppc.ObjectCollection.removeAll.

Removes all occurrences of e from this collection.

Parameters
e1:KType

Element to be removed from this collection, if present.

Returns:int

The number of removed elements as a result of this call.

Annotations
@Override
removeAllback to summary
public int removeAll(ObjectPredicate<? super KType> predicate)

Implements com.carrotsearch.hppc.ObjectCollection.removeAll, com.carrotsearch.hppc.ObjectCollection.removeAll.

Doc from com.carrotsearch.hppc.ObjectCollection.removeAll.

Removes all elements in this collection for which the given predicate returns true .

Returns:int

Returns the number of removed elements.

Annotations
@Override
removeAtBufferIndexback to summary
public void removeAtBufferIndex(int index)

Removes the element at index in the internal {#link buffer array, returning its value.

Parameters
index:int

Index of the element to remove. The index must be located between head and tail in modulo buffer arithmetic.

removeFirstback to summary
public KType removeFirst()

Implements com.carrotsearch.hppc.ObjectDeque.removeFirst.

Doc from com.carrotsearch.hppc.ObjectDeque.removeFirst.

Retrieves and removes the first element of this deque.

Returns:KType

the head (first) element of this deque.

Annotations
@Override
removeFirstback to summary
public int removeFirst(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.removeFirst.

Doc from com.carrotsearch.hppc.ObjectDeque.removeFirst.

Removes the first element that equals e.

Returns:int

The deleted element's index or -1 if the element was not found.

Annotations
@Override
removeLastback to summary
public KType removeLast()

Implements com.carrotsearch.hppc.ObjectDeque.removeLast.

Doc from com.carrotsearch.hppc.ObjectDeque.removeLast.

Retrieves and removes the last element of this deque.

Returns:KType

the tail of this deque.

Annotations
@Override
removeLastback to summary
public int removeLast(KType e1)

Implements com.carrotsearch.hppc.ObjectDeque.removeLast.

Doc from com.carrotsearch.hppc.ObjectDeque.removeLast.

Removes the last element that equals e.

Returns:int

The deleted element's index or -1 if the element was not found.

Annotations
@Override
sizeback to summary
public int size()

Implements com.carrotsearch.hppc.ObjectContainer.size.

Doc from com.carrotsearch.hppc.ObjectContainer.size.

Return the current number of elements in this container. The time for calculating the container's size may take O(n) time, although implementing classes should try to maintain the current size and return in constant time.

Annotations
@Override
toArrayback to summary
public Object[] toArray()

Overrides com.carrotsearch.hppc.AbstractObjectCollection.toArray.

Implements com.carrotsearch.hppc.ObjectContainer.toArray.

Doc from com.carrotsearch.hppc.ObjectContainer.toArray.

Copies all elements of this container to an array.

The returned array is always a copy, regardless of the storage used by the container.

Annotations
@Override
toArrayback to summary
public KType[] toArray(KType[] target)

Copies elements of this deque to an array. The content of the target array is filled from index 0 (head of the queue) to index size() - 1 (tail of the queue).

Parameters
target:KType[]

The target array must be large enough to hold all elements.

Returns:KType[]

Returns the target argument for chaining.

com.carrotsearch.hppc back to summary

private final Class ObjectArrayDeque.DescendingValueIterator

extends AbstractIterator<ObjectCursor<KType>>
Class Inheritance

An iterator implementation for ObjectArrayDeque#descendingIterator().

Field Summary

Modifier and TypeField and Description
private final ObjectCursor<KType>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ObjectCursor<KType>
fetch()

Implements abstract com.carrotsearch.hppc.AbstractIterator.fetch.

Fetch next element.

Inherited from com.carrotsearch.hppc.AbstractIterator:
donehasNextnextremove

Field Detail

cursorback to summary
private final ObjectCursor<KType> cursor
remainingback to summary
private int remaining

Constructor Detail

DescendingValueIteratorback to summary
public DescendingValueIterator()

Method Detail

fetchback to summary
protected ObjectCursor<KType> fetch()

Implements abstract com.carrotsearch.hppc.AbstractIterator.fetch.

Doc from com.carrotsearch.hppc.AbstractIterator.fetch.

Fetch next element. The implementation must return done() when all elements have been fetched.

Returns:ObjectCursor<KType>

Returns the next value for the iterator or chain-calls done().

Annotations
@Override
com.carrotsearch.hppc back to summary

private final Class ObjectArrayDeque.ValueIterator

extends AbstractIterator<ObjectCursor<KType>>
Class Inheritance

An iterator implementation for ObjectArrayDeque#iterator.

Field Summary

Modifier and TypeField and Description
private final ObjectCursor<KType>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ObjectCursor<KType>
fetch()

Implements abstract com.carrotsearch.hppc.AbstractIterator.fetch.

Fetch next element.

Inherited from com.carrotsearch.hppc.AbstractIterator:
donehasNextnextremove

Field Detail

cursorback to summary
private final ObjectCursor<KType> cursor
remainingback to summary
private int remaining

Constructor Detail

ValueIteratorback to summary
public ValueIterator()

Method Detail

fetchback to summary
protected ObjectCursor<KType> fetch()

Implements abstract com.carrotsearch.hppc.AbstractIterator.fetch.

Doc from com.carrotsearch.hppc.AbstractIterator.fetch.

Fetch next element. The implementation must return done() when all elements have been fetched.

Returns:ObjectCursor<KType>

Returns the next value for the iterator or chain-calls done().

Annotations
@Override