<i18n dev> RFR: 8289706: (cs) Avoid redundant TreeMap.containsKey call in AbstractCharsetProvider

Andrey Turbanov aturbanov at openjdk.org
Mon Jul 4 20:33:14 UTC 2022


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

https://github.com/openjdk/jdk/blob/df063f7db18a40ea7325fe608b3206a6dff812c1/src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java#L81-L84

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

-------------

Commit messages:
 - [PATCH] Avoid redundant TreeMap.containsKey call in AbstractCharsetProvider

Changes: https://git.openjdk.org/jdk/pull/8483/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=8483&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289706
  Stats: 13 lines in 1 file changed: 0 ins; 9 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/8483.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/8483/head:pull/8483

PR: https://git.openjdk.org/jdk/pull/8483


More information about the i18n-dev mailing list