112 assertThat(truePositives).isEqualTo(input.length / 2);
113
114 // Second half shouldn't be members
115 for (; i < input.length; i++) {116 falsePositives += filter.mightContain(input[i]) ? 1 : 0;
117 }
118 return falsePositives;
If a for loop can be converted to a foreach loop, consider doing so, as it is a more concise and readable syntax.
This issue is raised when the Java analyzer detects that all elements of a list/array are being iterated over, in sequence, and only one element of the iterable is accessed in one loop iteration.
for (int i = 0; i < list.size(); i++) {
SomeType value = list.get(i);
// do whatever is required with value.
}
Use the foreach
syntax to iterate over the iterable instead.
for (SomeType value : list) {
// Do the required operation.
}