Inspectopedia Help

Call to Map.get can be keyed access

Reports calls to java.util.Map.get() methods. Such calls could be replaced by the shorter and clearer keyed access form.


def map = ["foo": "bar"] def str = map.get("foo") // map.get("foo") could be replaced with map["foo"]

After the quick-fix is applied:

def map = ["foo": "bar"] def str = map["foo"]

Inspection Details

Available in:

IntelliJ IDEA 2024.2, Qodana for JVM 2024.2,


Groovy, 242.SNAPSHOT

Last modified: 20 February 2024