RFR 8191429 List.sort should specify the sort is stable

Stuart Marks stuart.marks at oracle.com
Fri Nov 17 07:15:38 UTC 2017


Hi Paul,

The change looks good.

s'marks

On 11/16/17 1:48 PM, Paul Sandoz wrote:
> Hi,
> 
> Please review the change in specification of List.sort to state the sort must be stable (CSR is already approved):
> 
> Thanks,
> Paul.
> 
> diff -r e0041b182e31 src/java.base/share/classes/java/util/List.java
> --- a/src/java.base/share/classes/java/util/List.java	Wed Nov 08 10:27:10 2017 -0800
> +++ b/src/java.base/share/classes/java/util/List.java	Thu Nov 16 13:47:46 2017 -0800
> @@ -442,7 +442,8 @@
> 
>       /**
>        * Sorts this list according to the order induced by the specified
> -     * {@link Comparator}.
> +     * {@link Comparator}.  The sort is <i>stable</i>: this method must not
> +     * reorder equal elements.
>        *
>        * <p>All elements in this list must be <i>mutually comparable</i> using the
>        * specified comparator (that is, {@code c.compare(e1, e2)} must not throw
> 


More information about the core-libs-dev mailing list