Extending Collector to handle a post-transform

Mike Duigou mike.duigou at oracle.com
Wed Jun 12 20:39:24 PDT 2013


On Jun 11 2013, at 10:04 , Brian Goetz wrote:

>> What's bad?
>> 
>>  - More generics in Collector signatures.  For Collectors that don't want to export their intermediate type, they are declared as Collector<T, ?, R>, which users may find disturbing. (The obvious attempts to make the extra type arg go away don't work.)

For me this extra type parameter for the intermediary on Collector is no different than the extra type param on BaseStream. Any time you have a type variable that is not part of the user's generification it's going to feel uncomfortable. For Collector the extra param goes largely un-noticed though Collector is rarely assigned. Collector is mostly used as an argument and in this case the wildcard is invisible. The types (and wildcards) just flow through unobserved. This seems fine and overall it's a huge benefit to handle the post-transform in the Collector.

Mike


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