Inspectopedia Help

Explicit array filling

Reports loops that can be replaced with Arrays.setAll() or Arrays.fill() calls.

This inspection suggests replacing loops with Arrays.setAll() if the language level of the project or module is 8 or higher. Replacing loops with Arrays.fill() is possible with any language level.

Example:

for (int i=0; i<array.length; i++) { array[i] = calc(i); }

After the quick-fix is applied:

Arrays.setAll(array, this::calc);

New in 2017.1

Inspection options

Option

Type

Default

Suggest 'Arrays.setAll()'

Checkbox

false

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023