Given the code fragment:
What is the result?
Given the code fragment:
What is the result?
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'.
A,tested
A is the correct answer
A is correct. Filter checks if list contains text1 which is true for first list in stream.