com.google.common.collect
Class AbstractRemovableIterator<T>

java.lang.Object
  extended by com.google.common.collect.AbstractIterator<T>
      extended by com.google.common.collect.AbstractRemovableIterator<T>
All Implemented Interfaces:
Iterator<T>

public abstract class AbstractRemovableIterator<T>
extends AbstractIterator<T>

A specialization of AbstractIterator for data sources which can handle arbitrary removal by element, concurrently with iteration. Subclasses must implement both the AbstractIterator.computeNext() and remove(Object) methods.

Author:
Kevin Bourrillion

Constructor Summary
AbstractRemovableIterator()
           
 
Method Summary
 T next()
           
 void remove()
          Removes from the underlying collection the last element returned by the iterator.
protected abstract  void remove(T element)
          Removes element from the backing data source.
 
Methods inherited from class com.google.common.collect.AbstractIterator
computeNext, endOfData, hasNext, peek
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRemovableIterator

public AbstractRemovableIterator()
Method Detail

remove

protected abstract void remove(T element)
Removes element from the backing data source.


next

public T next()
Specified by:
next in interface Iterator<T>
Overrides:
next in class AbstractIterator<T>

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator.

Specified by:
remove in interface Iterator<T>
Overrides:
remove in class AbstractIterator<T>