|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javimmutable.collections.cursors.AbstractStartCursor<V>
org.javimmutable.collections.cursors.LazyCursor<V>
V
- @Immutable public class LazyCursor<V>
Cursor that creates and returns a real Cursor for a specific iterable only when start() or next() is called for the first time.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.javimmutable.collections.Cursor |
---|
Cursor.NotStartedException, Cursor.NoValueException |
Constructor Summary | |
---|---|
LazyCursor(Cursorable<V> cursorable)
Creates a new LazyCursor for the specified cursorable. |
|
LazyCursor(Func0<Cursor<V>> factory)
Creates a new LazyCursor for the specified factory. |
Method Summary | ||
---|---|---|
Cursor<V> |
next()
Creates the real cursor using the factory and returns its next() method's result. |
|
static
|
of(Cursorable<V> cursorable)
Creates a new LazyPersistentIterator for the specified cursorable. |
|
static
|
of(Func0<Cursor<V>> factory)
Creates a new LazyPersistentIterator using the specified factory. |
Methods inherited from class org.javimmutable.collections.cursors.AbstractStartCursor |
---|
getValue, hasValue, iterator, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LazyCursor(Func0<Cursor<V>> factory)
factory
- a function to return an actual Cursor to use for iterationpublic LazyCursor(Cursorable<V> cursorable)
cursorable
- to return an actual Cursor to use for iterationMethod Detail |
---|
public static <V> LazyCursor<V> of(Func0<Cursor<V>> factory)
factory
- a Func0 capable of creating a real Cursorpublic static <V> LazyCursor<V> of(Cursorable<V> cursorable)
cursorable
- a PersistentIterable capable of producing a non-empty PersistentIterator@Nonnull public Cursor<V> next()
next
in interface Cursor<V>
next
in class AbstractStartCursor<V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |