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

Martijn Verburg martijnverburg at gmail.com
Thu Nov 16 11:17:46 UTC 2017


Hi Piotr,

Best to ask this Q over on the core-libs mailing list.

Cheers,
Martijn

On 16 November 2017 at 09:13, Piotr Findeisen <piotr.findeisen at gmail.com>
wrote:

> Hi,
>
> Today I realized the Collections.sort(List) ceased to be stable as of Java
> 8 (sort of).
>
> Although the method's documentation still promises stable sort, the
> implementation delegates to List.sort(Comparator) and that interface method
> bears no constraint that an implementation must sort stable.
>
> Is "stable" missing from List.sort's documentation?
> Or, instead, should it be now no longer promised by Collections.sort? (oh,
> no!)
> Or, what am i missing?
>
> Best regards,
> Piotr
>


More information about the discuss mailing list