if
statement that can end with break
without changing the semantics.
This prevents redundant loop iterations.
Example:
boolean found = false;
for (int i = 0; i < arr.length; i++) {
if (Objects.equals(value, arr[i])) {
found = true;
}
}
After the quick-fix is applied:
boolean found = false;
for (int i = 0; i < arr.length; i++) {
if (Objects.equals(value, arr[i])) {
found = true;
break;
}
}
New in 2019.2