On Sat, 30 Apr 2022 08:56:23 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

> The method `java.util.zip.ZipFile.Source#get` could be improved by usage of 
> `Map.putIfAbsent` instead of separate `containsKey`/`get`/`put` calls. We 
> known that HashMap `java.util.zip.ZipFile.Source#files` can contain only 
> non-null values. And to check if putIfAbsent was successful or not we can 
> just compare result with `null`.
> It makes code a bit cleaner and faster.

This pull request has now been integrated.

Changeset: 295be6f1
Author:    Andrey Turbanov <aturba...@openjdk.org>
URL:       
https://git.openjdk.java.net/jdk/commit/295be6f10ff50eb743c6840e7dcd319fe6f39d0f
Stats:     6 lines in 1 file changed: 0 ins; 1 del; 5 mod

8287285: Avoid redundant HashMap.containsKey call in 
java.util.zip.ZipFile.Source.get

Reviewed-by: jpai, alanb

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

PR: https://git.openjdk.java.net/jdk/pull/8481

Reply via email to