下面列出了java.util.PrimitiveIterator.OfDouble#nextDouble ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static Dimension toDimension(DoubleSortedSet thresholds) {
int size = thresholds.size();
Double2IntMap map = new Double2IntOpenHashMap(size);
int i = 1;
OfDouble it = thresholds.iterator();
while (it.hasNext()) {
double threshold = it.nextDouble();
map.put(threshold, i++);
}
return new Dimension(map);
}
public static OptionalDouble next(OfDouble it) {
if (it.hasNext()) {
double higher = it.nextDouble();
return OptionalDouble.of(higher);
}
return OptionalDouble.empty();
}
private void trim(OfDouble iterator) {
while (iterator.hasNext()) {
double current = iterator.nextDouble();
if (current <= first - count * intervalSize) {
double diff = first - current;
count = Math.max(count, (int) (diff / intervalSize)) + 1;
} else {
iterator.remove();
}
}
}