🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java Interview Questions: all 10 questions

Quiz: Java Interview Questions · Question 5 of 10

flatMap is used to:

flatMap is used to:

  1. A.Sort a stream
  2. B.Turn each element into a stream and merge them into one stream
  3. C.Remove null values
  4. D.Count elements
Answer & explanation

Correct answer: Turn each element into a stream and merge them into one stream

flatMap flattens nested structures, like a list of lists into one list.

Can you get the rest right without peeking?

Take the timed Quiz: Java Interview Questions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →