Is Collections.sort(List) still stable (java 8, 9..)?

Paul Sandoz paul.sandoz at
Thu Nov 16 17:56:00 UTC 2017

> On 16 Nov 2017, at 09:28, Piotr Findeisen <piotr.findeisen at> wrote:
> Hi Paul,
> I think this is also how it looks like in Java 8


> (but I also checked docs & code in 9 before posting).


> Basically, in List.sort docs, the word "stable" is @implNote for *default implementation*, not a contract that a subclass implementor must obey.
> At least I understand this that way.


> Thus, for List not having specialised sort implementation, Collections.sort(List) will be stable sort.
> For a List that has specialised sort implementation (that happens not to be stable),  Collections.sort(List)  will not be stable as well, even though javadoc expressly promises that.

Agreed, we need to specify the stability on List.sort (as we do for ordered streams on Stream.sorted).

I logged this issue: <>

Thanks for reporting this,

More information about the core-libs-dev mailing list