Which method retrieves, but does not remove, the first element of a Deque?

  1. pollFirst()
  2. element()
  3. peekFirst()
  4. getFirst()
Correct answer peekFirst()

Explanation

peekFirst() retrieves but does not remove the first element, returning null if empty.

Update: Admin added a tag on this question

Topics

By Admin · · 40 views