The ConcurrentLinkedDeque class provides more methods to get elements from the deque:
- getFirst() and getLast(): These methods return the first and last element from the deque, respectively. They don't remove the returned element from the deque. If the deque is empty, they throw a NoSuchElementExcpetion exception.
- peek(), peekFirst(), and peekLast(): These methods return the first and the last element of the deque, respectively. They don't remove the returned element from the deque. If the deque is empty, they return a null value.
- remove(), removeFirst(), and removeLast(): These methods return the first and last element of the deque, respectively. They remove the returned element as well. If the deque is empty, they throw ...