< prev index next >

src/java.base/share/classes/java/util/List.java

Print this page
rev 54827 : 6394757: AbstractSet.removeAll semantics are surprisingly dependent on relative sizes
Reviewed-by: XXX

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -290,11 +290,12 @@
 
     // Bulk Modification Operations
 
     /**
      * Returns {@code true} if this list contains all of the elements of the
-     * specified collection.
+     * specified collection. This operation uses the membership semantics
+     * of this list.
      *
      * @param  c collection to be checked for containment in this list
      * @return {@code true} if this list contains all of the elements of the
      *         specified collection
      * @throws ClassCastException if the types of one or more elements

@@ -362,11 +363,15 @@
      */
     boolean addAll(int index, Collection<? extends E> c);
 
     /**
      * Removes from this list all of its elements that are contained in the
-     * specified collection (optional operation).
+     * specified collection (optional operation). This operation uses the
+     * membership semantics of the specified collection.
+     *
+     * @implNote
+     * {@inheritDoc}
      *
      * @param c collection containing elements to be removed from this list
      * @return {@code true} if this list changed as a result of the call
      * @throws UnsupportedOperationException if the {@code removeAll} operation
      *         is not supported by this list

@@ -384,11 +389,15 @@
 
     /**
      * Retains only the elements in this list that are contained in the
      * specified collection (optional operation).  In other words, removes
      * from this list all of its elements that are not contained in the
-     * specified collection.
+     * specified collection. This operation uses the membership semantics of
+     * the specified collection.
+     *
+     * @implNote
+     * {@inheritDoc}
      *
      * @param c collection containing elements to be retained in this list
      * @return {@code true} if this list changed as a result of the call
      * @throws UnsupportedOperationException if the {@code retainAll} operation
      *         is not supported by this list

@@ -526,14 +535,14 @@
     /**
      * Compares the specified object with this list for equality.  Returns
      * {@code true} if and only if the specified object is also a list, both
      * lists have the same size, and all corresponding pairs of elements in
      * the two lists are <i>equal</i>.  (Two elements {@code e1} and
-     * {@code e2} are <i>equal</i> if {@code Objects.equals(e1, e2)}.)
-     * In other words, two lists are defined to be
+     * {@code e2} are <i>equal</i> if {@code (e1==null ? e2==null :
+     * e1.equals(e2))}.)  In other words, two lists are defined to be
      * equal if they contain the same elements in the same order.  This
-     * definition ensures that the equals method works properly across
+     * definition ensures that the {@code equals} method works properly across
      * different implementations of the {@code List} interface.
      *
      * @param o the object to be compared for equality with this list
      * @return {@code true} if the specified object is equal to this list
      */
< prev index next >