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.
  • 91,686
  • 21
  • 171
  • 177
fucipovon
  • 21
  • 1

0 Answers0