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