Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8268665

Deprecate Hashtable and ConcurrentHashMap.contains(Object)

    XMLWordPrintable

    Details

      Description

      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, see JDK-8134986. So it is likely that other projects fell for this as well.


        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: