← Quiz: Java 8 Lambdas and Streams: all 10 questions
Quiz: Java 8 Lambdas and Streams · Question 10 of 10
After List<Integer doubled = nums.stream().map(n - n 2).toList();, what is in nums?
After List<Integer> doubled = nums.stream().map(n -> n * 2).toList();, what is in nums?
- A.The doubled values
- B.Nothing; the stream emptied it
- C.The original values, unchanged
- D.It depends on the list size
Answer & explanation
Correct answer: The original values, unchanged
Streams never modify their source; the results go into a new list.
Can you get the rest right without peeking?
Take the timed Quiz: Java 8 Lambdas and Streams quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →