Stream method survey responses
Brian Goetz
brian.goetz at oracle.com
Thu Jan 24 09:33:34 PST 2013
I've closed the survey on Stream methods. Here's the full data for
people to browse on their own:
https://www.surveymonkey.com/sr.aspx?sm=Zv5N7TvvYN_2fcpK7zP3vLnAuM6F_2fvluAFb0eNub28P_2bw_3d
Here's a summary of comments. *PLEASE START SEPARATE, METHOD-SPECIFIC
THREADS FOR NONTRIVIAL REPLIES*.
filter -- No comments
map -- No comments
explode -- Lot's of comments here, clearly we're not done yet. Most
comments had to do with confusing naming.
uniqueElements -- "distinct" seemed preferred to "unique". Also, most
other method names are verby; I propose changing to "removeDuplicates"
or "filterDuplicates".
sorted -- strong desire to add sorted() which uses natural order (or
throws). Similar to above, should we replace "sorted" with "sort" to be
more verby?
forEach -- No comments.
forEachUntil -- Sam prefers a content-based forEachUntil. Remi prefers
we outlaw infinite streams.
tee -- Clear confusion over the name. This method is mostly for
debugging, since stream operations are jammed and therefore filtering,
mapping, and reducing all happen at once, while users might wanting to
see what happens after each stage. The tee() method lets users peek at
values that go by. The name "tee" suggests it creates a new stream,
which is wrong. Suggestions include "peek" or "tap".
limit / substream -- Suggested to change method parameter names to not
suggest indexing.
toArray -- Need code examples to illustrate array supplier. Suggestion
to use a Class literal instead of a lambda. (After extensive
reflection, I think this is a bad idea. Everything else in this API
uses constructor references, and we support array constructor references.)
reduce -- suggest parameter rename identity -> base. Remi hates Optional.
collect(Supplier, BiBlock, BiBlock) -- Don hates the name. Suggestion
to define in terms of collect(Collector).
collect(Collector) -- various naming suggestions
collectUnordered -- suggestion to use forEach instead
min/max -- Some distaste for Optional only being used when stream is empty.
xxxMatch -- no comments
findXxx -- Same comment about Optional for empty streams only
sequential / parallel -- minor naming nits.
From this, here's what I think is left to do:
- More work on explode needed
- Consider renaming uniqueElements / sorted / others for verbification
- Rename tee
- Parameter renaming
More information about the lambda-libs-spec-observers
mailing list