Package com.carrotsearch.hppc
Interface ShortDeque
-
- All Superinterfaces:
java.lang.Iterable<ShortCursor>,ShortCollection,ShortContainer
- All Known Implementing Classes:
ShortArrayDeque
@Generated(date="2024-05-16T12:00:00+0000", value="KTypeDeque.java") public interface ShortDeque extends ShortCollectionA linear collection that supports element insertion and removal at both ends.- See Also:
Deque
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFirst(short e)Inserts the specified element at the front of this deque.voidaddLast(short e)Inserts the specified element at the end of this deque.<T extends ShortProcedure>
TdescendingForEach(T procedure)Applies aprocedureto all elements in tail-to-head order.java.util.Iterator<ShortCursor>descendingIterator()shortgetFirst()Retrieves the first element of this deque but does not remove it.shortgetLast()Retrieves the last element of this deque but does not remove it.shortremoveFirst()Retrieves and removes the first element of this deque.intremoveFirst(short e)Removes the first element that equalse.shortremoveLast()Retrieves and removes the last element of this deque.intremoveLast(short e)Removes the last element that equalse.
-
-
-
Method Detail
-
removeFirst
int removeFirst(short e)
Removes the first element that equalse.- Returns:
- The deleted element's index or
-1if the element was not found.
-
removeLast
int removeLast(short e)
Removes the last element that equalse.- Returns:
- The deleted element's index or
-1if the element was not found.
-
addFirst
void addFirst(short e)
Inserts the specified element at the front of this deque.
-
addLast
void addLast(short e)
Inserts the specified element at the end of this deque.
-
removeFirst
short removeFirst()
Retrieves and removes the first element of this deque.- Returns:
- the head (first) element of this deque.
-
removeLast
short removeLast()
Retrieves and removes the last element of this deque.- Returns:
- the tail of this deque.
-
getFirst
short getFirst()
Retrieves the first element of this deque but does not remove it.- Returns:
- the head of this deque.
-
getLast
short getLast()
Retrieves the last element of this deque but does not remove it.- Returns:
- the head of this deque.
-
descendingIterator
java.util.Iterator<ShortCursor> descendingIterator()
- Returns:
- An iterator over elements in this deque in tail-to-head order.
-
descendingForEach
<T extends ShortProcedure> T descendingForEach(T procedure)
Applies aprocedureto all elements in tail-to-head order.
-
descendingForEach
<T extends ShortPredicate> T descendingForEach(T predicate)
Applies apredicateto container elements as long, as the predicate returnstrue. The iteration is interrupted otherwise.
-
-