Advanced Java Services | Deques |
Modifier and Type | Method and Description |
---|---|
void | addFirst(E e)
Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions. |
void | addLast(E e)
Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions. |
Iterator<E> | descendingIterator()
Returns an iterator over the elements in this deque in reverse sequential order. |
E | getFirst()
Retrieves, but does not remove, the first element of this deque. |
E | getLast()
Retrieves, but does not remove, the last element of this deque. |
boolean | offerFirst(E e)
Inserts the specified element at the front of this deque unless it would violate capacity restrictions. |
boolean | offerLast(E e)
Inserts the specified element at the end of this deque unless it would violate capacity restrictions. |
E | peekFirst()
Retrieves, but does not remove, the first element of this deque, or returns null if this deque is empty. |
E | peekLast()
Retrieves, but does not remove, the last element of this deque, or returns null if this deque is empty. |
E | pollFirst()
Retrieves and removes the first element of this deque, or returns null if this deque is empty. |
E | pollLast()
Retrieves and removes the last element of this deque, or returns null if this deque is empty. |
E | pop()
Pops an element from the stack represented by this deque. |
void | push(E e)
Pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available. |
E | removeFirst()
Retrieves and removes the first element of this deque. |
boolean | removeFirstOccurrence(Object o)
Removes the first occurrence of the specified element from this deque. |
E | removeLast()
Retrieves and removes the last element of this deque. |
boolean | removeLastOccurrence(Object o)
Removes the last occurrence of the specified element from this deque. |
Throws exception | Special value | |
Insert | add(E e)
Bereits in AbstractQueue realisiert, ruft offer(), throws IllegalStateException("Queue full") |
offer(E e)
Wird erst in Unterklassen von AbstractQueue realisiert. |
Remove | remove()
Liefert das Headelement. Bereits in AbstractQueue realisiert, ruft poll(), throws NoSuchElementException() |
poll()
Liefert das Headelement. Wird erst in Unterklassen von AbstractQueue realisiert. |
Examine | element()
Bereits in AbstractQueue realisiert, ruft peek(), throws NoSuchElementException() |
peek()
Liefert das Headelement, liefert null, falls die Queue leer ist. Wird erst in Unterklassen von AbstractQueue realisiert. |