Back to Intellij Community

GroovyMapGetCanBeKeyedAccess

plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyMapGetCanBeKeyedAccess.html

2025.3-rc-2335 B
Original Source

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

Example:

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"]