Extending Collector to handle a post-transform
Paul Sandoz
paul.sandoz at oracle.com
Wed May 29 08:33:43 PDT 2013
On May 29, 2013, at 5:06 PM, Brian Goetz <brian.goetz at Oracle.COM> wrote:
> I get the "that could be scary" reaction, but let's be more explicit about who has to deal with what incremental complexity.
>
> Most people will not write Collectors; most collectors that are used will have been written by Kevin or I.
>
> The proposed functionality would NOT affect any user code. Most users use canned collectors.
>
The only unpleasant smell i can detect is the use of a user supplied map, declared with values of type R, to store values of type I and R while collecting. I am prepared to hold my nose in such cases :-)
The following is perhaps worse than just documenting the restriction:
public static <T, K, D, M extends Map<K, D>, M1 extends Map<K, Object>>
Collector<T, M> groupingBy(Function<? super T, ? extends K> classifier,
Supplier<M1> mapFactory,
Collector<? super T, D> downstream) {
Paul.
More information about the lambda-libs-spec-experts
mailing list