When a collection is empty, iterating it has no effect. Doing so anyway is likely a bug; either population was accidentally omitted, or the iteration needs to be revised.
public void Method()
{
var values = new List<string>();
values.Remove("bar"); // Noncompliant
if (values.Contains("foo")) { } // Noncompliant
foreach (var str in values) { } // Noncompliant
}
public void Method()
{
var values = LoadValues();
values.Remove("bar");
if (values.Contains("foo")) { }
foreach (var str in values) { }
}