RFR 7065380 : Allow Collections.sort to sort Collections.singletonList() result

David Holmes david.holmes at oracle.com
Fri Mar 2 01:00:01 UTC 2012

On 2/03/2012 10:39 AM, Kevin Bourrillion wrote:
> The status quo is that the user who actually experiences this problem can,
> at worst, replace
>    Collections.sort(list);
> with
>    if (list.size()>  1)
>        Collections.sort(list);
> ... that doesn't seem so bad to me.

It is horrendous if you usually have very large collections and a size() 
operation that is not constant.

In the future operations like sort() may be part of the collection 
interfaces so you would expect to be able to apply them to any 
collection and to chain operations together in a pipeline.

> Just my $.01 ...

And mine



More information about the core-libs-dev mailing list