List<Thing> things = Stream.iterate(new Thing(), t->computeNextValue(t))
.limit(100).collect(Collectors.toList());
You can also use the method link for t->computeNextValue(t).
If computeNextValuethis is a method static, replace t->computeNextValue(t)with ContainingClass::computeNextValue, otherwise use this::computeNextValue.
source
share