Inspectopedia
 
2024.3

Bulk operation can be used instead of iteration

Warning
New
Last modified: 03 December 2024

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:

After the fix is applied:

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