Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 109

Given the code fragment:

What is the result?

    Correct Answer: A

    The code snippet first creates a stream of lists of strings. It then filters the stream to retain only those lists containing 'text1'. This will result in keeping only the first list ('text1', 'text2'). The flatMap operation then converts this list into a stream of its individual elements ('text1' and 'text2'), which are subsequently printed out without any spacing, resulting in 'text1text2'.

Discussion
Svetleto13Option: A

A,tested

asdfjhfgjuaDCVOption: A

A is the correct answer

steefaandOption: A

A is correct. Filter checks if list contains text1 which is true for first list in stream.