Java 8 Intstream for an Int Range?

Java 8 Intstream for an Int Range?

Is there a way to create an IntStream for a range of ints?

Like if I wanted to stream values 1 to 1000, I could invoke some IntStream static factory to stream that range?

IntStream.forRange(1, 1000).forEach(//do something...

1 Answer

Never mind, I don't know why I missed it in the API documentation after reading it several times...

IntStream.range(1,1000)
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.