why using ++i but not i++ in lambda

Viewed 309

I happen to know that, in the following expression, using i++ would result in infinite stream, i would be always 0. I am confused is because I think i++ returned value is not used, even so, it should not interrupt i increment afterwards.

IntStream.iterate(0, i-> i<10, i-> ++i).forEach(....)
3 Answers
Related