Which method returns an Optional describing the first element?

  1. first()
  2. findFirst()
  3. getFirst()
  4. peek()
Correct answer findFirst()

Explanation

findFirst() returns an Optional containing the first element.

Update: Admin added a tag on this question

Topics

By Admin · · 35 views