in hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java [72:97]
protected boolean fetch() {
assert this.current == none();
if (this.itors.isEmpty()) {
return false;
}
if (this.currentIterator != null && this.currentIterator.hasNext()) {
this.current = this.currentIterator.next();
return true;
}
Iterator<T> first;
while ((first = this.itors.peekFirst()) != null && !first.hasNext()) {
if (first == this.itors.peekLast() && this.itors.size() == 1) {
this.currentIterator = first;
// The last one
return false;
}
close(this.itors.removeFirst());
}
assert first != null && first.hasNext();
this.currentIterator = first;
this.current = this.currentIterator.next();
return true;
}