Brian Goetz brian.goetz at
Thu Mar 7 11:07:03 PST 2013

On Don's suggestion, I replaced the four forms of Collectors.joiningWith 
with two forms of toMap:

     Collector<T, Map<T,U>> toMap(Function<? super T, ? extends U> mapper)

Collector<T, M> toMap(Function<? super T, ? extends U> mapper,
                       Supplier<M> mapSupplier,
                       BinaryOperator<U> mergeFunction)

The four forms we had were:
  { has merge function, not } x { has ctor, not }

and these were replace with two forms: has nothing, has everything.

I think the toMap name makes more sense anyway.

We'll have to expose an entry point for the default merge function 
(which throws), currently is called Collectors.throwingMerger().  So if 
you want the default behavior but with TreeMap, you'd do:

   TreeMap<T, U> m = s.collect(toMap(func, TreeMap::new,

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