Simplify implementation of FilteredIterator

Closes gh-33902
This commit is contained in:
taehyun
2024-11-17 18:26:43 +09:00
committed by Sam Brannen
parent bb32df0a06
commit e0e96c487f

View File

@@ -55,17 +55,13 @@ final class FilteredIterator<E> implements Iterator<E> {
if (this.nextSet) {
return true;
}
else {
return setNext();
}
return setNext();
}
@Override
public E next() {
if (!this.nextSet) {
if (!setNext()) {
if (!this.nextSet && !setNext()) {
throw new NoSuchElementException();
}
}
this.nextSet = false;
Assert.state(this.next != null, "Next should not be null");