Inspectopedia Help

Call to Map.put can be keyed access

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


def map = ["foo": "bar"] map.put("foo", "baz") // map.put("foo", "baz") could be replaced with map["foo"] = "baz"

After the quick-fix is applied:

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

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Groovy, 233.SNAPSHOT

Last modified: 13 July 2023