The JavaDoc specifications about short circuiting operations only talk about infinite and finite streams and about the termination of these.
But I wonder if we can even safely assume that the elements will be processed in a "one-by-one" manner or in other words: Can we assume that there is not only short circuiting but even the least processing necessary to get the result?
For example:
Object first = list.stream().map(expensiveMappingFunction).findFirst().orElse(null);
Now it would be very nice to know if I can be sure that only exactly one element will be processed as the mapping function may take a long time per element (or any other reason that I really only want to call it once). Otherwise I would go with the good old empty()-check and iterator().next().
The JavaDoc does not seem to say anything about that specifically, so maybe we can't assume that.
But maybe there is some kind of "unofficial convention" like that.
Or maybe I just haven't understood Java streams quite enough yet and this is a dumb question (in which case you may gladly point it out!).