jdk/src/share/classes/java/util/IdentityHashMap.java
changeset 19855 bfe130545fe0
parent 19208 1e3d351eba80
child 21655 55f32ae4f920
equal deleted inserted replaced
19854:dda528ceb1de 19855:bfe130545fe0
   995          * Must revert from AbstractSet's impl to AbstractCollection's, as
   995          * Must revert from AbstractSet's impl to AbstractCollection's, as
   996          * the former contains an optimization that results in incorrect
   996          * the former contains an optimization that results in incorrect
   997          * behavior when c is a smaller "normal" (non-identity-based) Set.
   997          * behavior when c is a smaller "normal" (non-identity-based) Set.
   998          */
   998          */
   999         public boolean removeAll(Collection<?> c) {
   999         public boolean removeAll(Collection<?> c) {
       
  1000             Objects.requireNonNull(c);
  1000             boolean modified = false;
  1001             boolean modified = false;
  1001             for (Iterator<K> i = iterator(); i.hasNext(); ) {
  1002             for (Iterator<K> i = iterator(); i.hasNext(); ) {
  1002                 if (c.contains(i.next())) {
  1003                 if (c.contains(i.next())) {
  1003                     i.remove();
  1004                     i.remove();
  1004                     modified = true;
  1005                     modified = true;
  1210          * Must revert from AbstractSet's impl to AbstractCollection's, as
  1211          * Must revert from AbstractSet's impl to AbstractCollection's, as
  1211          * the former contains an optimization that results in incorrect
  1212          * the former contains an optimization that results in incorrect
  1212          * behavior when c is a smaller "normal" (non-identity-based) Set.
  1213          * behavior when c is a smaller "normal" (non-identity-based) Set.
  1213          */
  1214          */
  1214         public boolean removeAll(Collection<?> c) {
  1215         public boolean removeAll(Collection<?> c) {
       
  1216             Objects.requireNonNull(c);
  1215             boolean modified = false;
  1217             boolean modified = false;
  1216             for (Iterator<Map.Entry<K,V>> i = iterator(); i.hasNext(); ) {
  1218             for (Iterator<Map.Entry<K,V>> i = iterator(); i.hasNext(); ) {
  1217                 if (c.contains(i.next())) {
  1219                 if (c.contains(i.next())) {
  1218                     i.remove();
  1220                     i.remove();
  1219                     modified = true;
  1221                     modified = true;