RFR: 8305696: Avoid redundant LinkedHashMap.containsKey call ZipFileSystem.makeParentDirs

Andrey Turbanov aturbanov at openjdk.org
Thu Apr 6 09:13:13 UTC 2023


`LinkedHashMap<IndexNode, IndexNode>` `ZipFileSystem.inodes` contains only non-null values. It means instead of separate `containsKey`+`get` calls, we can use single `LinkedHashMap.get` call and then compare result with `null`.
Result code is a bit simpler and faster.

Testing: Linux x64 `java/nio`, `jdk/nio`

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

Commit messages:
 - [PATCH] Avoid redundant LinkedHashMap.containsKey call ZipFileSystem.makeParentDirs

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

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


More information about the nio-dev mailing list