-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Suggestion of Stream usage in Javadocs #8660
Description
I wanted to give my perspective on the wording from helpers such as Lists.transform, namely the following:
guava/guava/src/com/google/common/collect/Lists.java
Lines 545 to 547 in 14c81e5
I know it's a gentle suggestion to use Streams, but I still find Lists.transform and other lazy transformation methods superior for a lot of usage in the wild; for example, I often see a stream used to map to a target type, only to then be passed to an addAllFoo style method of a proto builder... which is just iterating and copying into another List. That sort of use case where you know it's a one shot iteration is generally more efficiently served via these Guava helpers from Lists, Collections2, Iterables, etc. No real action item here, just hoping that the Javadoc doesn't lead people to always reach for streams, as I find the Guava helpers still have their legitimate uses.