public abstract class JBIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>
Constructor and Description |
---|
JBIterator() |
Modifier and Type | Method and Description |
---|---|
boolean |
advance()
Proceeds to the next element if any and returns true; otherwise false.
|
E |
current()
Returns the current element if any; otherwise throws exception.
|
protected void |
currentChanged()
Called right after the new current value is set.
|
static <E extends JBIterator<?>> |
cursor(E iterator) |
JBIterator<E> |
filter(Condition<? super E> condition) |
<T> JBIterator<T> |
filterMap(Function<? super E,? extends T> function) |
static <E> JBIterator<E> |
from(java.util.Iterator<? extends E> it) |
JBIterable<Function<java.lang.Object,java.lang.Object>> |
getTransformations() |
boolean |
hasNext() |
<T> JBIterator<T> |
map(Function<? super E,? extends T> function) |
E |
next() |
protected abstract E |
nextImpl()
Returns the next element if any; otherwise calls stop() or skip().
|
void |
remove() |
protected E |
skip()
Notifies the iterator to skip and re-invoke nextImpl().
|
JBIterator<E> |
skip(int count) |
JBIterator<E> |
skipWhile(Condition<? super E> condition) |
protected E |
stop()
Notifies the iterator that there's no more elements.
|
JBIterator<E> |
take(int count) |
JBIterator<E> |
takeWhile(Condition<? super E> condition) |
java.util.List<E> |
toList() |
java.lang.String |
toString() |
public static <E extends JBIterator<?>> JBIterable<E> cursor(E iterator)
public static <E> JBIterator<E> from(java.util.Iterator<? extends E> it)
protected abstract E nextImpl()
protected void currentChanged()
protected final E stop()
protected final E skip()
public final boolean hasNext()
hasNext
in interface java.util.Iterator<E>
public final boolean advance()
public final E current()
public final <T> JBIterator<T> map(Function<? super E,? extends T> function)
public final JBIterator<E> filter(Condition<? super E> condition)
public final <T> JBIterator<T> filterMap(Function<? super E,? extends T> function)
public final JBIterator<E> take(int count)
public final JBIterator<E> takeWhile(Condition<? super E> condition)
public final JBIterator<E> skip(int count)
public final JBIterator<E> skipWhile(Condition<? super E> condition)
public final void remove()
remove
in interface java.util.Iterator<E>
public final java.util.List<E> toList()
public java.lang.String toString()
toString
in class java.lang.Object
public final JBIterable<Function<java.lang.Object,java.lang.Object>> getTransformations()