Call to 'list.containsAll(collection)' may have poor performance
Reports calls to
The time complexity of this method call is O(n·m), where n is the number of elements in the list on which the method is called, and m is the number of elements in the collection passed to the method as a parameter. When the list is large, this can be an expensive operation.
The quick-fix wraps the list in
new java.util.HashSet<>() since the time required to create
java.util.List and execute
java.util.HashSet is O(n+m).
After the quick-fix is applied:
New in 2022.1
IntelliJ IDEA 2023.3, Qodana for JVM 2023.3