Collectors.to* signatures

Brian Goetz brian.goetz at oracle.com
Fri May 10 17:41:57 PDT 2013


We are generally exceedingly down on the idea of something returning 
Foo<? extends ...>, for obvious reasons -- its annoying and useless. 
Here, the uselessness is the intended goal, but that doesn't do anything 
about the annoying part.

On 5/10/2013 8:02 PM, Michael Nascimento wrote:
> Hi guys,
>
> I wonder what you think about this one.
>
> Regards,
> Michael
>
>
> On Thu, Apr 18, 2013 at 9:54 PM, Michael Nascimento <misterm at gmail.com> wrote:
>> Hi guys,
>>
>> Just got bitten by the fact toList() *might* produce an immutable list.
>>
>> Since we don't have immutable collections as types in Java, I wonder
>> if the old ugly List<? extends T> wouldn't be a better return type,
>> effectively preventing people from doing what I did.
>>
>> Regards,
>> Michael
>


More information about the lambda-dev mailing list