I have the following statement:
Function<Stream<Supplier<Collection<? extends User>>>, Stream<User>> userStreamSupplier =
supStream -> {
ArrayList<User> list = new ArrayList<>();
supStream.forEach(sup -> list.addAll(sup.get()));
return list.stream();
};
Is it possible to convert a loop in the inner lambda to a smart stream.reduce operation (or other aggregation)? I'd tried various approaches but I failed.
Greetings, JG.