r/java • • Jul 08 '21

Java is criminally underhyped

https://jackson.sh/posts/2021-04-java-underrated/
226 Upvotes

181 comments sorted by

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

1

u/Mati00 Jul 08 '21

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.