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

Avoid redundant HashMap.containsKey call in EnvHelp.mapToHashtable

XMLWordPrintable

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

      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);

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

              Created:
              Updated:
              Resolved: