I read this api doc Stream api and it says ( three sentences in a paragraph )
"An intermediate operation is short-circuiting if, when presented with infinite input, it may produce a finite stream as a result."
"A terminal operation is short-circuiting if, when presented with infinite input, it may terminate in finite time."
"Having a short-circuiting operation in the pipeline is a necessary, but not sufficient, condition for the processing of an infinite stream to terminate normally in finite time."
I don't understand why intermediate and terminal operations are short-circuiting if, when presented with infinite input.
I don't understand third sentence as well why short-circuiting is necessary but insufficient condition for processing infinite stream to terminate normally in finite time.
It would be great if someone helps me to understand with a code example.
What I know about short-circuiting is like
for example, if( a && b ) { ... } if a is false, you don't have to check b.