Use Map#containsKey

MSAL

map.keySet().contains(a) can be simplified to map.containsKey(a).

org.openrewrite.staticanalysis.UseMapContainsKey
mod run . --recipe=org.openrewrite.staticanalysis.UseMapContainsKey

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Simplify a call chain