public static FastIterator valueOf(FastCollection collection) { FastIterator iterator = (FastIterator) FastIterator.FACTORY.object(); iterator._collection = collection; iterator._next = collection.head().getNext(); iterator._tail = collection.tail(); return iterator; }
public void remove() { if (_current != null) { // Uses the previous record (not affected by the remove) // to set the next record. final Record previous = _current.getPrevious(); _collection.delete(_current); _current = null; _next = previous.getNext(); } else { throw new IllegalStateException(); } }
public Object next() { if (_next == _tail) throw new NoSuchElementException(); _current = _next; _next = _next.getNext(); return _collection.valueOf(_current); }