On Fri, 29 Apr 2022 06:31:22 GMT, Andrey Turbanov wrote:
> `Map.containsKey` call is sometimes unnecessary, when it's known that Map
> doesn't contain `null` values.
> Instead we can just use Map.get and compare result with `null`.
> I found one of such place, where Map.containsKey calls could
On Fri, 29 Apr 2022 06:31:22 GMT, Andrey Turbanov wrote:
> `Map.containsKey` call is sometimes unnecessary, when it's known that Map
> doesn't contain `null` values.
> Instead we can just use Map.get and compare result with `null`.
> I found one of such place, where Map.containsKey calls could
On Fri, 29 Apr 2022 06:31:22 GMT, Andrey Turbanov wrote:
> `Map.containsKey` call is sometimes unnecessary, when it's known that Map
> doesn't contain `null` values.
> Instead we can just use Map.get and compare result with `null`.
> I found one of such place, where Map.containsKey calls could
On Fri, 29 Apr 2022 06:31:22 GMT, Andrey Turbanov wrote:
> `Map.containsKey` call is sometimes unnecessary, when it's known that Map
> doesn't contain `null` values.
> Instead we can just use Map.get and compare result with `null`.
> I found one of such place, where Map.containsKey calls could
On Fri, 29 Apr 2022 20:45:20 GMT, Andrey Turbanov wrote:
>> src/java.base/share/classes/java/time/format/ZoneName.java.template line 60:
>>
>>> 58:
>>> 59: public static String toZid(String zid) {
>>> 60: return aliases.getOrDefault(zid, zid);
>>
>> Is the behavior if zid == null
On Fri, 29 Apr 2022 20:36:59 GMT, Roger Riggs wrote:
>aliases.getOrDefault will throw NPE on null
No, It will not. `aliases` is a HashMap. And HashMap supports null values and
keys.
-
PR: https://git.openjdk.java.net/jdk/pull/8463
On Fri, 29 Apr 2022 06:31:22 GMT, Andrey Turbanov wrote:
> `Map.containsKey` call is sometimes unnecessary, when it's known that Map
> doesn't contain `null` values.
> Instead we can just use Map.get and compare result with `null`.
> I found one of such place, where Map.containsKey calls could
`Map.containsKey` call is sometimes unnecessary, when it's known that Map
doesn't contain `null` values.
Instead we can just use Map.get and compare result with `null`.
I found one of such place, where Map.containsKey calls could be eliminated -
`java.time.format.ZoneName`.
it gives a bit of