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

  1. peekLast()
  2. pollLast()
  3. getLast()
  4. element()
Correct answer peekLast()

Explanation

peekLast() returns the last element or null if empty without removing it.

Update: Admin added a tag on this question

Topics

By Admin · · 252 views