< 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 **** /* ! * Copyright (c) 1997, 2018, 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 --- 1,7 ---- /* ! * 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,300 **** // Bulk Modification Operations /** * Returns {@code true} if this list contains all of the elements of the ! * specified collection. * * @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 --- 290,301 ---- // Bulk Modification Operations /** * Returns {@code true} if this list contains all of the elements of the ! * 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,372 **** */ 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). * * @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 --- 363,377 ---- */ 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). 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,394 **** /** * 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. * * @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 --- 389,403 ---- /** * 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. 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,539 **** /** * 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 * equal if they contain the same elements in the same order. This ! * definition ensures that the 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 */ --- 535,548 ---- /** * 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 (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 {@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 >