org.javimmutable.collections.cursors
Class ValueFunctionCursor

java.lang.Object
  extended by org.javimmutable.collections.cursors.ValueFunctionCursor
Direct Known Subclasses:
CloseableValueFunctionCursor

public abstract class ValueFunctionCursor
extends Object

Provides standard Cursor objects for iterating over the values of arbitrary functions. The cursors are actually created using a factory object that can produce the functions. The factories ensure that a Cursor is restartable and permits lazy evaluation of the beginning of iteration. The function will only be created if the starting Cursor's start() or next() method is invoked.

The Cursors are not immutable but are designed to act as though they are. Cursors remember their next value between invocations so that standard look ahead behavior is preserved.

The Cursors are not thread safe.


Nested Class Summary
protected static class ValueFunctionCursor.Start<T,F extends ValueFunction<T>,A extends ValueFunctionFactory<T,F>>
           
 
Constructor Summary
ValueFunctionCursor()
           
 
Method Summary
static
<T,F extends ValueFunction<T>,A extends ValueFunctionFactory<T,F>>
Cursor<T>
of(A factory)
          Produces a non-thread safe Cursor to traverse the values returned by a function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueFunctionCursor

public ValueFunctionCursor()
Method Detail

of

public static <T,F extends ValueFunction<T>,A extends ValueFunctionFactory<T,F>> Cursor<T> of(A factory)
Produces a non-thread safe Cursor to traverse the values returned by a function. The function will be created using the factory when the traversal is initiated by calling the next() method. Multiple invocations of the initial Cursor's next() method will produce multiple functions using the factory.

Type Parameters:
T -
Parameters:
factory -
Returns:


Copyright © 2014 Burton Computer Corporation. All rights reserved.