Integrated: 8287602: (fs) Avoid redundant HashMap.containsKey call in MimeTypesFileTypeDetector.putIfAbsent
Andrey Turbanov
aturbanov at openjdk.java.net
Wed Jun 1 18:19:33 UTC 2022
On Sun, 29 May 2022 20:41:04 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: 27ad1d55
Author: Andrey Turbanov <aturbanov at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/27ad1d5549ebb65053ca2061e89d970ac3fe23a5
Stats: 5 lines in 1 file changed: 0 ins; 3 del; 2 mod
8287602: (fs) Avoid redundant HashMap.containsKey call in MimeTypesFileTypeDetector.putIfAbsent
Reviewed-by: bpb, jpai, alanb
-------------
PR: https://git.openjdk.java.net/jdk/pull/8941
More information about the nio-dev
mailing list