org.javimmutable.collections
Interface Sequence<T>

Type Parameters:
T -
All Known Subinterfaces:
JImmutableStack<T>
All Known Implementing Classes:
EmptySequence, JImmutableLinkedStack

public interface Sequence<T>

Interface for collections that contain a head value and a tail containing the remainder of the sequence.


Method Summary
 T getHead()
          Accesses the first value in the Sequence.
 Sequence<T> getTail()
          Accesses the rest of the Sequence.
 boolean isEmpty()
          Determines if this is the end of the Sequence.
 

Method Detail

isEmpty

boolean isEmpty()
Determines if this is the end of the Sequence. When try the Sequence is empty and getHead() cannot be called. getTail() can still be called but will always return an empty Sequence once isEmpty() returns true.

Returns:

getHead

T getHead()
Accesses the first value in the Sequence.

Returns:

getTail

@Nonnull
Sequence<T> getTail()
Accesses the rest of the Sequence.

Returns:


Copyright © 2014 Burton Computer Corporation. All rights reserved.