33

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...
Tagir Valeev
  • 92,683
  • 18
  • 210
  • 320
tmn
  • 10,211
  • 14
  • 53
  • 107

1 Answers1

61

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

IntStream.range(1,1000)
tmn
  • 10,211
  • 14
  • 53
  • 107