net.floodlightcontroller.util
Class FilterIterator<T>

java.lang.Object
  extended by net.floodlightcontroller.util.FilterIterator<T>
All Implemented Interfaces:
java.util.Iterator<T>
Direct Known Subclasses:
DeviceIterator

public abstract class FilterIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>

An iterator that will filter values from an iterator and return only those values that match the predicate.


Field Summary
protected  T next
           
protected  java.util.Iterator<T> subIterator
           
 
Constructor Summary
FilterIterator(java.util.Iterator<T> subIterator)
          Construct a filter iterator from the given sub iterator
 
Method Summary
 boolean hasNext()
           
protected abstract  boolean matches(T value)
          Check whether the given value should be returned by the filter
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subIterator

protected java.util.Iterator<T> subIterator

next

protected T next
Constructor Detail

FilterIterator

public FilterIterator(java.util.Iterator<T> subIterator)
Construct a filter iterator from the given sub iterator

Parameters:
subIterator - the sub iterator over which we'll filter
Method Detail

matches

protected abstract boolean matches(T value)
Check whether the given value should be returned by the filter

Parameters:
value - the value to check
Returns:
true if the value should be included

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<T>

next

public T next()
Specified by:
next in interface java.util.Iterator<T>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<T>