🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.The doubled values
  2. B.Nothing; the stream emptied it
  3. C.The original values, unchanged
  4. 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 →