|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.molae.pipe.filter.HeadIterator<E>
public final class HeadIterator<E>
Returns all elements of the base iterator while the elements fulfil a specific condition. The first element that does not fulfil the condition is also returned.
Constructor Summary | |
---|---|
HeadIterator(Iterator<? extends E> base,
TypedPredicate<? super E> filter)
Constructs a new head iterator. |
Method Summary | ||
---|---|---|
boolean |
hasNext()
|
|
E |
next()
|
|
void |
remove()
Removes from the underlying collection of the base iterator the last element returned by this iterator. |
|
static
|
whileIterator(Iterator<? extends E> base,
TypedPredicate<? super E> filter)
Returns an iterator that returns all elements of the base iterator while the elements fulfil the specified condition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HeadIterator(Iterator<? extends E> base, TypedPredicate<? super E> filter)
base
- The base iteratorfilter
- The condition all elements but the last must fulfil.
NullPointerException
- if the specified objects are
null
.Method Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator<E>
public E next()
next
in interface Iterator<E>
public void remove()
remove
in interface Iterator<E>
IllegalStateException
- if the next method has not
yet been called, or the remove method has already
been called after the last call to the next method.
UnsupportedOperationException
- depending on the base iteratorpublic static <E> Iterator<E> whileIterator(Iterator<? extends E> base, TypedPredicate<? super E> filter)
base
- The base iteratorfilter
- The condition all elements but the last must fulfil.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |