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

(cs) Avoid redundant TreeMap.containsKey call in AbstractCharsetProvider

    XMLWordPrintable

Details

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

    Description

      The method sun.nio.cs.ext.AbstractCharsetProvider#put is effectively equivalent of Map.putIfAbsent call.

          private static <K,V> void put(Map<K,V> m, K name, V value) {
              if (!m.containsKey(name))
                  m.put(name, value);
          }

      Instead of hand-written method we can use 'putIfAbsent' directly.
      I makes code cleaner and gives a bit of performance.

      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: