ensuring that LinkedHashTreeMap.contains() returns false when non-Comparable() keys are passed to it
This commit is contained in:
parent
6f0a6a4662
commit
6347e9b9c6
@ -196,9 +196,13 @@ public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements
|
||||
return created;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // this method throws ClassCastExceptions!
|
||||
@SuppressWarnings("unchecked")
|
||||
Node<K, V> findByObject(Object key) {
|
||||
return key != null ? find((K) key, false) : null;
|
||||
try {
|
||||
return key != null ? find((K) key, false) : null;
|
||||
} catch (ClassCastException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user