Inspectopedia Help

Call to List.set can be keyed access

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

Example:

def list = ["foo"] list.set(0, "bar") // list.set(0, "bar") could be replaced with list[0] = "bar"

After the quick-fix is applied:

def list = ["foo"] list[0] = "bar"

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Groovy, 233.SNAPSHOT

Last modified: 13 July 2023