in core/src/main/java/org/apache/commons/functor/range/CharacterRange.java [164:199]
protected Iterator<Character> createIterator() {
return new Iterator<Character>() {
private char currentValue;
{
currentValue = leftEndpoint.getValue();
if (leftEndpoint.getBoundType() == BoundType.OPEN) {
this.currentValue += step;
}
}
public void remove() {
throw new UnsupportedOperationException();
}
public Character next() {
final int step = getStep();
final char r = currentValue;
currentValue += step;
return Character.valueOf(r);
}
public boolean hasNext() {
final int cmp = Character.valueOf(currentValue).compareTo(rightEndpoint.getValue());
if (cmp == 0) {
return rightEndpoint.getBoundType() == BoundType.CLOSED;
}
if (step > 0) {
return cmp < 0;
}
return cmp > 0;
}
};
}