'List.indexOf()' expression can be replaced with 'contains()'
Reports any
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) {