Extending Collector to handle a post-transform

Tim Peierls tim at peierls.net
Tue Jun 11 10:44:26 PDT 2013


On Tue, Jun 11, 2013 at 1:26 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> Yes, it's not yet "all gain, no pain".  Where I am now, the existence of
>> an internal type still appears; Collector takes type arguments <T, I, R>
>> (input, intermediate, result), but all the occurrences of Collector in the
>> API specify ? as the second parameter:
>
>
>     public static Collector<String, ?, String> toStringBuilder()
>

That's not as bad as I feared, but given the importance of Collector to the
whole Stream framework, I'm still worried about scaring people away with
mysterious type parameters. Could Collector<T, R> extend BaseCollector<T,
X, R>? Implementers of the latter care about X, clients of the former don't.

--tim


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