| |
|
| java.lang.Object xtc.util.Pair
Pair | public class Pair (Code) | | Implementation of a pair. Pairs are used to construct immutable
singly-linked lists, not unlike cons cells in Scheme (with the
differences that pairs are immutable and that the second pointer
always references another pair).
author: Robert Grimm version: $Revision: 1.1 $ |
Field Summary | |
final public static Pair | EMPTY The pair representing the empty list. |
Method Summary | |
public boolean | isEmpty() Determine whether the list starting at this pair is empty. | public Iterator | iterator() Get an iterator over the values of the list starting at this
pair. | public List | list() Get a Java Collections list with the values of the list starting
at this pair. | public Pair | next() Get the next pair. | public int | size() Get the size of the list starting at this pair. | public Object | value() Get this pair's value. |
EMPTY | final public static Pair EMPTY(Code) | | The pair representing the empty list. This object serves as a
sentinel to avoid special-casing null .
|
Pair | public Pair(Object value)(Code) | | Create a new pair. The newly created pair represents a singleton
list.
Parameters: value - The value. |
Pair | public Pair(Object value, Pair next)(Code) | | Create a new pair.
Parameters: value - The value. Parameters: next - The next pair. throws: NullPointerException - Signals that next is null . |
isEmpty | public boolean isEmpty()(Code) | | Determine whether the list starting at this pair is empty.
true if the list is empty. |
iterator | public Iterator iterator()(Code) | | Get an iterator over the values of the list starting at this
pair.
The iterator. |
list | public List list()(Code) | | Get a Java Collections list with the values of the list starting
at this pair.
The Java Collections list. |
size | public int size()(Code) | | Get the size of the list starting at this pair.
The size. |
|
|
|