@Override public int compareTo(final ComparableIterator that) { if (comparator.getClass() != comparator.getClass()) { throw new IllegalStateException( "Can't compare two ComparableIterators that have different orderings."); } return comparator.compare(this.peek(), that.peek()); }