Collector / Collectors

Howard Lovatt howard.lovatt at
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

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> wrote:

> I think I may (finally!) have a final API candidate for Collector /
> Collectors.  Updated docs here:
> 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:

  -- Howard.

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