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

Avoid redundant HashMap.containsKey call in EnvHelp.mapToHashtable

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 20
    • None
    • core-svc

    Description

      No need to separately perform HashMap.containsKey before HashMap.remove call. If key is present - it will be removed anyway. If it's not present, nothing will be deleted.

           HashMap<K, V> m = new HashMap<K, V>(map);
           if (m.containsKey(null)) m.remove(null);

      Attachments

        Issue Links

          Activity

            People

              aturbanov Andrey Turbanov
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: