equal
deleted
inserted
replaced
699 */ |
699 */ |
700 public Object clone() { |
700 public Object clone() { |
701 try { |
701 try { |
702 IdentityHashMap<K,V> m = (IdentityHashMap<K,V>) super.clone(); |
702 IdentityHashMap<K,V> m = (IdentityHashMap<K,V>) super.clone(); |
703 m.entrySet = null; |
703 m.entrySet = null; |
704 m.table = (Object[])table.clone(); |
704 m.table = table.clone(); |
705 return m; |
705 return m; |
706 } catch (CloneNotSupportedException e) { |
706 } catch (CloneNotSupportedException e) { |
707 throw new InternalError(); |
707 throw new InternalError(); |
708 } |
708 } |
709 } |
709 } |
973 * the former contains an optimization that results in incorrect |
973 * the former contains an optimization that results in incorrect |
974 * behavior when c is a smaller "normal" (non-identity-based) Set. |
974 * behavior when c is a smaller "normal" (non-identity-based) Set. |
975 */ |
975 */ |
976 public boolean removeAll(Collection<?> c) { |
976 public boolean removeAll(Collection<?> c) { |
977 boolean modified = false; |
977 boolean modified = false; |
978 for (Iterator i = iterator(); i.hasNext(); ) { |
978 for (Iterator<K> i = iterator(); i.hasNext(); ) { |
979 if (c.contains(i.next())) { |
979 if (c.contains(i.next())) { |
980 i.remove(); |
980 i.remove(); |
981 modified = true; |
981 modified = true; |
982 } |
982 } |
983 } |
983 } |
1031 } |
1031 } |
1032 public boolean contains(Object o) { |
1032 public boolean contains(Object o) { |
1033 return containsValue(o); |
1033 return containsValue(o); |
1034 } |
1034 } |
1035 public boolean remove(Object o) { |
1035 public boolean remove(Object o) { |
1036 for (Iterator i = iterator(); i.hasNext(); ) { |
1036 for (Iterator<V> i = iterator(); i.hasNext(); ) { |
1037 if (i.next() == o) { |
1037 if (i.next() == o) { |
1038 i.remove(); |
1038 i.remove(); |
1039 return true; |
1039 return true; |
1040 } |
1040 } |
1041 } |
1041 } |
1119 * the former contains an optimization that results in incorrect |
1119 * the former contains an optimization that results in incorrect |
1120 * behavior when c is a smaller "normal" (non-identity-based) Set. |
1120 * behavior when c is a smaller "normal" (non-identity-based) Set. |
1121 */ |
1121 */ |
1122 public boolean removeAll(Collection<?> c) { |
1122 public boolean removeAll(Collection<?> c) { |
1123 boolean modified = false; |
1123 boolean modified = false; |
1124 for (Iterator i = iterator(); i.hasNext(); ) { |
1124 for (Iterator<Map.Entry<K,V>> i = iterator(); i.hasNext(); ) { |
1125 if (c.contains(i.next())) { |
1125 if (c.contains(i.next())) { |
1126 i.remove(); |
1126 i.remove(); |
1127 modified = true; |
1127 modified = true; |
1128 } |
1128 } |
1129 } |
1129 } |