← Quiz: Java Interview Questions: all 10 questions
Quiz: Java Interview Questions · Question 5 of 10
flatMap is used to:
flatMap is used to:
- A.Sort a stream
- B.Turn each element into a stream and merge them into one stream
- C.Remove null values
- 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 →