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

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

    Correct Answer: A

    A stream cannot be consumed more than once. Once a terminal operation is performed on a stream, it becomes exhausted and cannot be used again. Attempting to reuse the stream after it has been consumed will result in an IllegalStateException.

Discussion
varconiteOption: A

Answer is A

HanenBAOption: A

After the terminal operation is performed, the stream pipeline is considered consumed, and can no longer be used. For Intermediate operations,they always return a new stream

jduarteOption: A

Answer is A

Svetleto13Option: E

A and E are correct.

asdfjhfgjuaDCVOption: A

A is the answer

steefaandOption: A

A is true as exception is thrown if same stream is used after terminal operation is run on it.

iSnoverOption: A

The answer is letter A, a stream can only be consumed once. Regarding the letter E, it is false, pay attention that the statement talks about the stream parameter and not the method parameter, you cannot use a lambda expression as a stream parameter, it is a trick.

duydnOption: A

A & E are correct!

WilsonKKerllOption: B

A is NOT. Can use peak() consumed more than one. Answer is B. Because can change parallel stream to change mode.

iSnover

No, the "peek()" method is an intermediate operation

Eason_from_the_futureOption: A

stream takes no parameter, so E is incorrect.

HuimOption: E

Is E correct?