R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does `takeWhile()` do in a stream?

  • (A) Takes all matching elements at any position
  • (B) Takes elements until predicate returns false
  • (C) Skips first matching elements
  • (D) Always returns full stream
  • Correct Answer - Option(B)
  • Views: 7
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`takeWhile()` takes elements while the predicate is true, stopping when it first fails.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.