RFR: 8287602: (fs) Avoid redundant HashMap.containsKey call in MimeTypesFileTypeDetector.putIfAbsent
Andrey Turbanov
aturbanov at openjdk.java.net
Tue May 31 21:08:22 UTC 2022
Only non-null values are put into `Map<String,String> mimeTypeMap`. It means, we can replace `containsKey`+`put` calls with single `putIfAbsent` call. It makes code a bit cleaner and faster.
https://github.com/openjdk/jdk/blob/3d2d039538b906cedd9188ed94b7ba55c275ff7f/src/java.base/unix/classes/sun/nio/fs/MimeTypesFileTypeDetector.java#L189-L196
-------------
Commit messages:
- [PATCH] Avoid redundant HashMap.containsKey call in MimeTypesFileTypeDetector.putIfAbsent
- [PATCH] Avoid redundant HashMap.containsKey call in MimeTypesFileTypeDetector.putIfAbsent
Changes: https://git.openjdk.java.net/jdk/pull/8941/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8941&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8287602
Stats: 5 lines in 1 file changed: 0 ins; 3 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/8941.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8941/head:pull/8941
PR: https://git.openjdk.java.net/jdk/pull/8941
More information about the nio-dev
mailing list