Inspectopedia Help

Redundant operation on empty container

Reports redundant operations on empty collections, maps or arrays.

Iterating, removing elements, sorting, and some other operations on empty collections have no effect and can be removed. Also, they may be a signal of a bug.


if (numbers.isEmpty()){ //error due to the missed negation int max =; ... }

New in 2019.1

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023