Extending Collector to handle a post-transform

Paul Sandoz paul.sandoz at oracle.com
Mon Jun 17 03:29:50 PDT 2013


On Jun 15, 2013, at 3:42 AM, Brian Goetz <brian.goetz at Oracle.COM> wrote:

> Browsing the Javadoc for Collectors, the merge functions (throw, first-wins, last-wins) seem kind of out of place, and are hardly used anywhere in our implementation.  If we ditched them, Collectors would be entirely about Collectors, which I think would be an improvement? They're trivial to just write inline:
> 
>  (x,y) -> x
> 
> instead of firstWinsMerger().
> 

+1 on removing first/last wins mergers. 

I am pausing a little on the throwingMerger. We capture the most important case of throw-based merging in the 2 arg to{Concurrent}Map function, but what if someone wants to switch from the 2 arg to the 4 arg method to change the map impl?

Perhaps we can move throwingMerger to Map renamed to match the wording on Map.merge ?

Paul.


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