O'Reilly logo
  • MICHAEL BORROWDALE thinks this is interesting:

System.out.printf("%d ", i)

Note

This appears to not work since count() can compute the number of elements without traversing the stream. This means that the peek() is never executed. Replacing count() with limit(5) (which obviously has no effect on operations) results in the expected behaviuour wrt. peek