Class ReusingMutableToRegularIteratorWrapper<T>

  • All Implemented Interfaces:
    Iterable<T>, Iterator<T>

    public class ReusingMutableToRegularIteratorWrapper<T>
    extends Object
    implements Iterator<T>, Iterable<T>
    This class wraps a MutableObjectIterator into a regular Iterator. Internally, it uses two record instances which it uses alternating. That way, whenever hasNext() returns (possibly with false), the previous obtained record is still valid and cannot have been overwritten internally.