Package com.carrotsearch.hppc
Interface ObjectDeque<KType>
- All Superinterfaces:
Iterable<ObjectCursor<KType>>
,ObjectCollection<KType>
,ObjectContainer<KType>
- All Known Implementing Classes:
ObjectArrayDeque
@Generated(date="2024-05-16T08:18:11+0000",
value="KTypeDeque.java")
public interface ObjectDeque<KType>
extends ObjectCollection<KType>
A linear collection that supports element insertion and removal at both ends.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts the specified element at the front of this deque.void
Inserts the specified element at the end of this deque.<T extends ObjectProcedure<? super KType>>
TdescendingForEach
(T procedure) Applies aprocedure
to all elements in tail-to-head order.getFirst()
Retrieves the first element of this deque but does not remove it.getLast()
Retrieves the last element of this deque but does not remove it.Retrieves and removes the first element of this deque.int
removeFirst
(KType e) Removes the first element that equalse
.Retrieves and removes the last element of this deque.int
removeLast
(KType e) Removes the last element that equalse
.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
removeFirst
Removes the first element that equalse
.- Returns:
- The deleted element's index or
-1
if the element was not found.
-
removeLast
Removes the last element that equalse
.- Returns:
- The deleted element's index or
-1
if the element was not found.
-
addFirst
Inserts the specified element at the front of this deque. -
addLast
Inserts the specified element at the end of this deque. -
removeFirst
KType removeFirst()Retrieves and removes the first element of this deque.- Returns:
- the head (first) element of this deque.
-
removeLast
KType removeLast()Retrieves and removes the last element of this deque.- Returns:
- the tail of this deque.
-
getFirst
KType getFirst()Retrieves the first element of this deque but does not remove it.- Returns:
- the head of this deque.
-
getLast
KType getLast()Retrieves the last element of this deque but does not remove it.- Returns:
- the head of this deque.
-
descendingIterator
Iterator<ObjectCursor<KType>> descendingIterator()- Returns:
- An iterator over elements in this deque in tail-to-head order.
-
descendingForEach
Applies aprocedure
to all elements in tail-to-head order. -
descendingForEach
Applies apredicate
to container elements as long, as the predicate returnstrue
. The iteration is interrupted otherwise.
-