Which statement is true about java.util.stream.Stream?

Which statement is true about java.util.stream.Stream?
A. A stream cannot be consumed more than once.
B. The execution mode of streams can be changed during processing.
C. Streams are intended to modify the source data.
D. A parallel stream is always faster than an equivalent sequential stream.

Download Printable PDF. VALID exam to help you PASS.

8 thoughts on “Which statement is true about java.util.stream.Stream?

  1. Correct Answer is A because after it reaches its terminal operation cant be consumed take note
    IllegalStateException

  2. B

    A) stream can be consumed many times, such as peek()
    C) stream won’t change the source data
    D) not always faster

      1. peek() can consume stream twice.

        Listnums=Arrays.asList(10,20,8);
        System.out.println(
        nums.stream()
        .peek(System.out::println)
        .peek(System.out::println)
        .count());

        this code runs with no problem.

  3. Correct answer is A, I agree with @Pete. 1zo-809 prep brought me here and unfortunately they are as wrong as the exam guide am using.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.