'List.indexOf()' expression can be replaced with 'contains()'

Last modified: Last modified: 18 September 2025

Reports any List.indexOf() expressions that can be replaced with the List.contains() method.

Example:

The provided quick-fix replaces the indexOf call with the contains call: