8287602: (fs) Avoid redundant HashMap.containsKey call in MimeTypesFileTypeDetector.putIfAbsent

Reviewed-by: bpb, jpai, alanb
This commit is contained in:
Andrey Turbanov 2022-06-01 18:14:25 +00:00
parent 239ac2a5d4
commit 27ad1d5549

View file

@ -187,11 +187,8 @@ class MimeTypesFileTypeDetector extends AbstractFileTypeDetector {
} }
private void putIfAbsent(String key, String value) { private void putIfAbsent(String key, String value) {
if (key != null && !key.isEmpty() && if (!key.isEmpty() && !value.isEmpty()) {
value != null && !value.isEmpty() && mimeTypeMap.putIfAbsent(key, value);
!mimeTypeMap.containsKey(key))
{
mimeTypeMap.put(key, value);
} }
} }
} }