Collector / Collectors

Howard Lovatt howard.lovatt at gmail.com
Thu Jun 20 01:53:47 PDT 2013


Not in expert group hence comments below rather than with SurveyMonkey:

CloseableStream doesn't pull its weight just add close to Stream. If it is
retained then all the fluent methods should return a CloseableStream (not
all the fluent methods are in the interface and those that are strangely
return an S - whatever S is).

In DoubleStream the following aren't really worth providing: boxed (use
mapToObj), count (provide a count collector), distinct (provide
a distinct filter), forEachOrdered (replace with ordered), max (provide a
collector), min (provide a collector), noneMatch (use !anyMatch), sorted
(provide a sorted mapper), sum (provide a collector), and summaryStatistics
(provide a collector).

In DoubleStream could add method isOrdered (compliments the other is
methods).

In DoubleStream could rename method: iterate (how about infinite to
complement empty and not confused with an iterator).

In DouibleStream could eliminate the method iterator and make DoubleStream
extend PrimitiveIterator.OfDouble (and add its methods) and add methods
or(DoubleStream) and orThrow(Exception). Then eliminate OptionalDouble and
have methods like findFirst return a DoubleStream that is either the empty
stream or a stream of one value (from of(double)).

As DoubleStream above for IntStream, LongStream, and Stream.


On 19 June 2013 01:58, Brian Goetz <brian.goetz at oracle.com> wrote:

> I think I may (finally!) have a final API candidate for Collector /
> Collectors.  Updated docs here:
>
>   http://cr.openjdk.java.net/~**briangoetz/doctmp/doc/<http://cr.openjdk.java.net/~briangoetz/doctmp/doc/>
>
> Salient recent changes:
>  - Incorporation of finishing function into Collector
>  - Renamings in Collector API
>  - Morph toStringBuilder, toStringJoiner into joining()
>  - Add prefix/suffix version of joining()
>  - Addition of summingBy{Int,Long,Double}
>  - Addition of averagingBy{Int,Long,Double}
>  - Rename toXxxSummaryStatistics to summarizingXxx
>  - no-see reducing, and minBy/maxBy collectors return Optional
>  - elimination of canned merger functions from API
>
> Please review the API and spec.  I have set up a SurveyMonkey with the
> usual password to collect review comments at:
>
>   https://www.surveymonkey.com/**s/3TTBJ7K<https://www.surveymonkey.com/s/3TTBJ7K>
>
>
>


-- 
  -- Howard.


More information about the lambda-libs-spec-observers mailing list