List.indexOf()
expressions that can be replaced with the
List.contains()
method.
Example:
boolean hasEmptyString(List<String> list) {
// Warning: can be simplified
return list.indexOf("") >= 0;
}
The provided quick-fix replaces the indexOf
call with the contains
call:
boolean hasEmptyString(List<String> list) {
// Quick-fix is applied
return list.contains("");
}