jdk/src/share/classes/java/util/AbstractCollection.java
changeset 17441 5ae43433d158
parent 14342 8435a30053c1
child 22114 e9be73bceec1
equal deleted inserted replaced
17440:fb37aa6b305e 17441:5ae43433d158
   366      *
   366      *
   367      * @see #remove(Object)
   367      * @see #remove(Object)
   368      * @see #contains(Object)
   368      * @see #contains(Object)
   369      */
   369      */
   370     public boolean removeAll(Collection<?> c) {
   370     public boolean removeAll(Collection<?> c) {
       
   371         Objects.requireNonNull(c);
   371         boolean modified = false;
   372         boolean modified = false;
   372         Iterator<?> it = iterator();
   373         Iterator<?> it = iterator();
   373         while (it.hasNext()) {
   374         while (it.hasNext()) {
   374             if (c.contains(it.next())) {
   375             if (c.contains(it.next())) {
   375                 it.remove();
   376                 it.remove();
   399      *
   400      *
   400      * @see #remove(Object)
   401      * @see #remove(Object)
   401      * @see #contains(Object)
   402      * @see #contains(Object)
   402      */
   403      */
   403     public boolean retainAll(Collection<?> c) {
   404     public boolean retainAll(Collection<?> c) {
       
   405         Objects.requireNonNull(c);
   404         boolean modified = false;
   406         boolean modified = false;
   405         Iterator<E> it = iterator();
   407         Iterator<E> it = iterator();
   406         while (it.hasNext()) {
   408         while (it.hasNext()) {
   407             if (!c.contains(it.next())) {
   409             if (!c.contains(it.next())) {
   408                 it.remove();
   410                 it.remove();