org.aksw.commons.collections.cache.CountingIterator Maven / Gradle / Ivy
package org.aksw.commons.collections.cache;
import java.util.Iterator;
public class CountingIterator
extends IteratorDecorator
{
protected long numItems;
public CountingIterator(Iterator delegate) {
this(delegate, 0l);
}
public CountingIterator(Iterator delegate, long numItems) {
super(delegate);
this.numItems = numItems;//new AtomicLong(numItems);
}
public long getNumItems() {
return numItems; //.get();
}
@Override
public T next() {
T result = super.next();
++numItems;
//numItems.incrementAndGet();
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy