Код: Выделить всё
PrimitiveIterator.OfInt iterator = IntStream.rangeClosed(1, 1000).iterator();
while (iterator.hasNext()) {
System.out.println(iterator.nextInt()); // not .next() !!
}
Подробнее здесь: https://stackoverflow.com/questions/533 ... ator-ofint
Мобильная версия