@Override
public boolean hasNext() {
while (next == null) {
if (!compIter.hasNext()) return false;
CompositeState c = compIter.next();
// If we're filtering by indexed component (or not at all), no need for an extra comparison
if (whereRow < 0 || whereRow == indexComponent) {
next = c;
} else {
if (c.getComponent(whereRow).equals(whereState)) {
next = c;
}
}
}
return true;