Use BasicMapEntry

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@945 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent fe52b35239
commit 1b3a2fb9cc
  1. 36
      jode/jode/util/SimpleMap.java

@ -49,41 +49,11 @@ public class SimpleMap extends AbstractMap {
return backing; return backing;
} }
public static class SimpleEntry implements Map.Entry { public static class SimpleEntry extends BasicMapEntry {
Object key;
Object value;
public SimpleEntry(Object key, Object value) { public SimpleEntry(Object key, Object value) {
this.key = key; super(key, value);
this.value = value;
}
public Object getKey() {
return key;
}
public Object getValue() {
return value;
}
public Object setValue(Object newValue) {
Object old = value;
value = newValue;
return old;
}
public int hashCode() {
return key.hashCode() ^ value.hashCode();
} }
}
public boolean equals(Object o) {
if (o instanceof Map.Entry) {
Map.Entry e = (Map.Entry) o;
return key.equals(e.getKey()) && value.equals(e.getValue());
}
return false;
}
}
public Object put(Object key, Object value) { public Object put(Object key, Object value) {
for (Iterator i = backing.iterator(); for (Iterator i = backing.iterator();

Loading…
Cancel
Save