diff --git a/spring-core/src/main/java/org/springframework/util/FilteredIterator.java b/spring-core/src/main/java/org/springframework/util/FilteredIterator.java index dcf48cbcd61..96c9c18ffce 100644 --- a/spring-core/src/main/java/org/springframework/util/FilteredIterator.java +++ b/spring-core/src/main/java/org/springframework/util/FilteredIterator.java @@ -55,17 +55,13 @@ final class FilteredIterator implements Iterator { 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");