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

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Groovy, 241.16690

Last modified: 29 April 2024