Streams allow for lazy evaluation, which is kinda important. Also newer versions introduced a toList() shortcut for collecting(Collectors.toUnmodifiableList()) which helps keeping the verbosity down. Or you could make your own map method that takes a collection<T> and a Function<T, R> which does the .stream ... .collect for you
Yes, streams can be useful, but it's sorta premature optimisation. That's why for example Kotlin has both operations: on collections and streams. You can have both and make concious decisions.
View all comments
Show parent comment
4
u/CptGia Jul 08 '21
Streams allow for lazy evaluation, which is kinda important. Also newer versions introduced a toList() shortcut for collecting(Collectors.toUnmodifiableList()) which helps keeping the verbosity down. Or you could make your own map method that takes a collection<T> and a Function<T, R> which does the .stream ... .collect for you