Suspicious collection method call
Reports method calls on parameterized collections, where the actual argument type does not correspond to the collection's elements type.
Example:
List<Integer> list = getListOfElements();
list.remove(""); // remove is highlighted
In the inspection settings, you can disable warnings for potentially correct code like the following:
public boolean accept(Map<Integer, String> map, Object key) {
return map.containsKey(key);
}
Inspection options
Option | Type | Default |
---|---|---|
Report suspicious but possibly correct method calls | Checkbox | true |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023