mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
"Fix" Map.containsKey() and Map.containsValue()
java.util.Map.containsKey() and java.util.Map.containsValue() take Object parameters, not K and V. Changed to improve classpath compatibility.
This commit is contained in:
parent
d11195165f
commit
af784f4cbc
@ -143,10 +143,10 @@ public class Collections {
|
||||
public void clear() {
|
||||
synchronized (lock) { map.clear(); }
|
||||
}
|
||||
public boolean containsKey(K key) {
|
||||
public boolean containsKey(Object key) {
|
||||
synchronized (lock) { return map.containsKey(key); }
|
||||
}
|
||||
public boolean containsValue(V value) {
|
||||
public boolean containsValue(Object value) {
|
||||
synchronized (lock) { return map.containsValue(value); }
|
||||
}
|
||||
public Set<java.util.Map.Entry<K, V>> entrySet() {
|
||||
|
@ -158,12 +158,12 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
return c;
|
||||
}
|
||||
|
||||
public boolean containsKey(K key) {
|
||||
return find(key) != null;
|
||||
public boolean containsKey(Object key) {
|
||||
return find((K)key) != null;
|
||||
}
|
||||
|
||||
public boolean containsValue(V value) {
|
||||
return values().contains(value);
|
||||
public boolean containsValue(Object value) {
|
||||
return values().contains((V)value);
|
||||
}
|
||||
|
||||
public V get(K key) {
|
||||
|
@ -40,11 +40,11 @@ public class Hashtable<K, V> implements Map<K, V> {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
public synchronized boolean containsKey(K key) {
|
||||
public synchronized boolean containsKey(Object key) {
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
public synchronized boolean containsValue(V value) {
|
||||
public synchronized boolean containsValue(Object value) {
|
||||
return map.containsValue(value);
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ public class IdentityHashMap<K, V> implements Map<K, V> {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
public boolean containsKey(K key) {
|
||||
public boolean containsKey(Object key) {
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
public boolean containsValue(V value) {
|
||||
public boolean containsValue(Object value) {
|
||||
return map.containsValue(value);
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@ public interface Map<K, V> {
|
||||
|
||||
public int size();
|
||||
|
||||
public boolean containsKey(K key);
|
||||
public boolean containsKey(Object key);
|
||||
|
||||
public boolean containsValue(V value);
|
||||
public boolean containsValue(Object value);
|
||||
|
||||
public V get(K key);
|
||||
|
||||
|
@ -44,12 +44,12 @@ public class WeakHashMap<K, V> implements Map<K, V> {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
public boolean containsKey(K key) {
|
||||
public boolean containsKey(Object key) {
|
||||
poll();
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
public boolean containsValue(V value) {
|
||||
public boolean containsValue(Object value) {
|
||||
poll();
|
||||
return map.containsValue(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user