org.javimmutable.collections.cursors
Class SingleValueCursor<T>

java.lang.Object
  extended by org.javimmutable.collections.cursors.AbstractStartCursor<T>
      extended by org.javimmutable.collections.cursors.SingleValueCursor<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>, Cursor<T>

@Immutable
public class SingleValueCursor<T>
extends AbstractStartCursor<T>

A Cursor containing exactly one value to be traversed.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.javimmutable.collections.Cursor
Cursor.NotStartedException, Cursor.NoValueException
 
Method Summary
 Iterator<T> iterator()
           
 Cursor<T> next()
          Advances to the next (possibly first) value.
static
<V> SingleValueCursor<V>
of(V value)
           
 
Methods inherited from class org.javimmutable.collections.cursors.AbstractStartCursor
getValue, hasValue, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

of

@Nonnull
public static <V> SingleValueCursor<V> of(V value)

next

@Nonnull
public Cursor<T> next()
Description copied from interface: Cursor
Advances to the next (possibly first) value. Must always return a non-null Cursor. A newly created Cursor must always point to "before" the first value because next() (or start()) must always be called once before retrieving the first value. If the Cursor is already at the end of its sequence then it should return a Cursor that will always return false for hasValue().

Specified by:
next in interface Cursor<T>
Overrides:
next in class AbstractStartCursor<T>
Returns:
Cursor for next position

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>
Overrides:
iterator in class AbstractStartCursor<T>


Copyright © 2014 Burton Computer Corporation. All rights reserved.