-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 16
-
Component/s: core-libs
A DESCRIPTION OF THE PROBLEM :
For historical reasons both Hashtable and ConcurrentHashMap have a `contains(Object)` method which checks if the map contains an entry which has the given value (not key!). These methods are obsolete (as even indicated by their documentation) since java.util.Map has a `containsValue(Object)` method.
It would therefore be good to deprecate these methods because the name `contains` is highly misleading / not very expressive. Even in the JDK itself there was a bug where `contains(Object)` (checking the value) instead of `containsKey(Object)` was used by accident, seeJDK-8134986. So it is likely that other projects fell for this as well.
For historical reasons both Hashtable and ConcurrentHashMap have a `contains(Object)` method which checks if the map contains an entry which has the given value (not key!). These methods are obsolete (as even indicated by their documentation) since java.util.Map has a `containsValue(Object)` method.
It would therefore be good to deprecate these methods because the name `contains` is highly misleading / not very expressive. Even in the JDK itself there was a bug where `contains(Object)` (checking the value) instead of `containsKey(Object)` was used by accident, see