|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.collections.FilteredIterator<E>
E
- the type of the accepted objects.public abstract class FilteredIterator<E>
Represents an iterator traversing a restricted
subset of the elements enumerated by another iterator.
A filtered iterator encapsulates an
ordinary iterator, and uses it to
enumerate objects.
However, this iterator only returns objects passing
the test implemented in the user-defined filter(java.lang.Object)
method.
For example, this class could be used to
iterate over objects of a
certain subclass or having certain properties.
Note that this iterator does not support
the remove()
operation.
Constructor Summary | |
---|---|
FilteredIterator(Iterator<? super E> it)
Constructs a new filtered iterator from the iterator it. |
|
FilteredIterator(Iterator<? super E> it,
int maxNumElements)
Constructs a new filtered iterator from the iterator it, and returning at most maxNumElements elements. |
Method Summary | |
---|---|
abstract boolean |
filter(Object o)
Determines if the object o is returned by this iterator. |
Iterator<? super E> |
getInnerIterator()
Returns the inner iterator used by this iterator. |
int |
getMaxNumElements()
Returns the maximal number of elements that can be traversed by this iterator, or Integer.MAX_VALUE if
the number of elements is not bounded. |
boolean |
hasNext()
|
E |
next()
|
void |
remove()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilteredIterator(Iterator<? super E> it)
it
- the iterator being filtered.
NullPointerException
- if it is null.public FilteredIterator(Iterator<? super E> it, int maxNumElements)
it
- the iterator being filtered.maxNumElements
- the maximal number of elements the iterator can return.
NullPointerException
- if it is null.
IllegalArgumentException
- if maxNumElements
is negative.Method Detail |
---|
public Iterator<? super E> getInnerIterator()
public int getMaxNumElements()
Integer.MAX_VALUE
if
the number of elements is not bounded.
This does not affect the number of elements
traversed by the inner iterator and passed
to the filter(java.lang.Object)
method.
public abstract boolean filter(Object o)
o
- the tested object.
public boolean hasNext()
hasNext
in interface Iterator<E>
public E next()
next
in interface Iterator<E>
public void remove()
remove
in interface Iterator<E>
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |