O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

There's more...

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required