Refactor of Collector interface

Tim Peierls tim at peierls.net
Fri Feb 8 09:13:09 PST 2013


On Fri, Feb 8, 2013 at 11:22 AM, Kevin Bourrillion <kevinb at google.com>wrote:

> My subjective sense of good Java API design very strongly prefers the
> "before" picture here, which I see as a lot more "Java-like", so I'm taking
> a closer look.


The before picture is certainly more pre-lambda-Java-like, but I don't
think it's fair to knock something meant to fit well with a new language
feature by those rules.

I thought the return types of the after picture conveyed more clearly the
idea of "I'm going to need a way to supply result objects, and way to
accumulate elements into result objects, and a way to combine result
objects."  And seeing those interface types as return types reinforced my
understanding of those types.


I assume that the trade-offs we're weighing here are purely to do with what
> it's like to be a Collector implementor, correct?
>

Well, since I persist in preferring the after picture -- maybe the
impending blizzard has addled my senses -- I'd say the benefit to Collector
implementers is secondary.

--tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130208/3298fcb5/attachment.html 


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