[java] AvoidArrayLoops could also check for list copy through iterated List.add() #2587
Labels
an:enhancement
An improvement on existing features / rules
Milestone
Affects PMD Version:
6.22.0
Rule:
AvoidArrayLoops
Description:
It is recommended to have AvoidArrayLoops additionally check the case using that for loop + list.add() to copy a list
Similar to using for loop to manually copy data between two arrays, using for loop + list.add() to manually copy data between two list can also be simplified to
Collections.addAll(dest, source)
Code Sample demonstrating the suggestion:
Example 1:
Example 2:
Type:
Suggestions for rule improvement
Running PMD through:
CLI
The text was updated successfully, but these errors were encountered: