peek().iterator().hasNext() pre-consumes elements?

Dmitry Bessonov dmitry.bessonov at oracle.com
Tue Feb 12 09:53:23 PST 2013


Hello,

The following line prints out the first element, "1"

   Arrays.asList(1, 2, 
3).stream().peek(System.err::println).iterator().hasNext()

Is it really an expected behavior?

-Dmitry




More information about the lambda-dev mailing list