Inspectopedia 2025.2 Help

Bulk operation can be used instead of iteration

Reports single operations inside loops that could be replaced with a bulk method.

Not only are bulk methods shorter, but in some cases they may be more performant as well.

Example:

void test(Collection<Integer> numbers) { List<Integer> result = new ArrayList<>(); for (Integer i : numbers) { result.add(i); } }

After the fix is applied:

void test(Collection<Integer> numbers) { List<Integer> result = new ArrayList<>(); result.addAll(numbers); }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

UseBulkOperation
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Performance

The Use Arrays.asList() to wrap arrays option allows to report arrays, even if the bulk method requires a collection. In this case the quick-fix will automatically wrap the array in Arrays.asList() call.

New in 2017.1

Inspection options

Here you can find the description of settings available for the Bulk operation can be used instead of iteration inspection, and the reference of their default values.

Use 'Arrays.asList()' to wrap arrays

Default value:

Selected

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection UseBulkOperation

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025