(cs) Avoid redundant TreeMap.containsKey call in AbstractCharsetProvider

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 20
    • Affects Version/s: None
    • Component/s: core-libs

      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.

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

              Created:
              Updated:
              Resolved: