O'Reilly logo
  • Tansu Dasli thinks this is interesting:

If you’ve read Chapter 17, consider how you might calculate factorials using lambdas and streams, rather than recursion.

From

Cover of Java® 9 for Programmers, Fourth Edition

Note

int count = 5;
System.out.println(IntStream.rangeClosed(1, count).reduce(1, (x,y) -> x*y));

result = 120