Extending Collector to handle a post-transform

Joe Bowbeer joe.bowbeer at gmail.com
Tue Jun 11 15:34:29 PDT 2013


This toList looks bad to me. What's in the javadoc is what the IDE presents
(right?), and I'm not very optimistic about the ? options it suggests. I'll
try everything first.
On Jun 11, 2013 3:27 PM, "Brian Goetz" <brian.goetz at oracle.com> wrote:

> OK, scratch that. Here's a different approach:
>>
>
>  For example,
>>
>> /** Passed to Stream methods by client code */
>> public interface Collector<T, R> {
>>      <X> Tuple<T, X, R> asTuple();
>>
>>      /** Called on by Stream implementations to perform collection
>> process */
>>      interface Tuple<T, X, R> {
>>          Supplier<X> resultSupplier();
>>          BiFunction<X, T, X> accumulator();
>>          BinaryOperator<X> combiner();
>>          Function<X, R> transformer();
>>          Set<Characteristics> characteristics();
>>      }
>> }
>>
>
> Right, that's one of the forms of "move the ugly elsewhere."
>
> But really, do you find this:
>
>     public static <T>
>     Collector<T, ?, List<T>> toList() { ... }
>
> all that offensive?  If you found that in the javadoc, would it really
> make you wonder what that ? was all about?  Because this is really as bad
> as it gets.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130611/bc4e8aa5/attachment.html 


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