Extending Collector to handle a post-transform

Remi Forax forax at univ-mlv.fr
Tue Jun 11 16:31:56 PDT 2013


On 06/12/2013 01:24 AM, Brian Goetz wrote:
>> Still don't get why you can not do:
>> interface SimpleCollector<T, R> extends Collector<T, R, R> {
>>    ...
>> }
>
> Not all Collectors will have I=R.  Consider toStringBuilder, where 
> I=StringBuilder and R=String.

yes, for the ones without post-function like toList, you can use the 
SimpleCollector, for the ones like toString you use the full blown 
Collector.

Rémi



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