@Override
    public IndexEntry next() {
      if (!hasNext()) {
        throw new IllegalStateException("Called next() when hasNext() is false");
      }
      if (!indexEntriesIterator.hasNext()) {
        loadEntriesFromNextIndexSegment();
      }
      return indexEntriesIterator.next();
    }
Creates an {@link Iterator} that can iterate through all the index entries in {@code index}.
@param index the {@link PersistentIndex} whose entries need to be iterated on.
ambry-tools/src/main/java/com/github/ambry/store/CompactionVerifier.java