RFR: 8287390: Cleanup Map usage in AuthenticationInfo.requestAuthentication
Daniel Fuchs
dfuchs at openjdk.java.net
Wed Jun 1 13:18:31 UTC 2022
On Sat, 30 Apr 2022 10:17:43 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> `AuthenticationInfo.requestAuthentication` uses separate `HashMap`'s `get` +`put` calls.
>
> https://github.com/openjdk/jdk/blob/176bb23de18d9ab448e77e85a9c965a7c02f2c50/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java#L155-L165
>
> Instead we can use the `HashMap.putIfAbsent` to make code a bit easier to follow. We know that `requests` can contain only non-null values.
LGTM
-------------
Marked as reviewed by dfuchs (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8484
More information about the net-dev
mailing list