RFR 8191429 List.sort should specify the sort is stable

Paul Sandoz paul.sandoz at oracle.com
Thu Nov 16 21:48:45 UTC 2017


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