net.cscott.jutil
Class Default.PairList<A,B>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList
net.cscott.jutil.Default.PairList<A,B>
- All Implemented Interfaces:
- Serializable, Iterable, Collection, List
- Enclosing class:
- Default
public static class Default.PairList<A,B>
- extends AbstractList
- implements Serializable
Pairs, implemented as a List.
The Default.PairList implements hashCode()
and equals() "properly" so they can be used as keys
in hashtables and etc. They are implemented as mutable lists of
fixed size 2. Note that the hashCode() implementation
differs from pairs implemented as Map.Entrys; the
parameterization is different as well.
- See Also:
- Serialized Form
| Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList |
Default.PairList
public Default.PairList(A left,
B right)
left
public A left()
- Return the left element of the pair (head).
right
public B right()
- Return the right element of the pair (tail).
size
public int size()
- Specified by:
size in interface Collection- Specified by:
size in interface List- Specified by:
size in class AbstractCollection
get
public Object get(int index)
- Specified by:
get in interface List- Specified by:
get in class AbstractList
set
public Object set(int index,
Object element)
- Specified by:
set in interface List- Overrides:
set in class AbstractList
Copyright (c) 2006 C. Scott Ananian