2

Why this produces one "1" and then is not terminating but going to infinite loop of no results?

Stream.of("x")
      .flatMap(_x -> Stream.iterate(1, i -> i + 1))
      .limit(1)
      .forEach(System.out::println);
Alexis C.
  • 87,500
  • 20
  • 164
  • 172
fucipovon
  • 21
  • 1

0 Answers0