ensuring that LinkedHashTreeMap.contains() returns false when non-Comparable() keys are passed to it

This commit is contained in:
Inderjeet Singh 2013-04-12 21:10:21 +00:00
parent 6f0a6a4662
commit 6347e9b9c6

View File

@ -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;
}
}
/**