For the latest news and information visit
The GNU Crypto project

gnu.crypto.util
Class SimpleList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by gnu.crypto.util.SimpleList
All Implemented Interfaces:
Iterable, Collection, List

public final class SimpleList
extends AbstractList

A simple way to create immutable n-tuples. This class can be created with up to four elements specified via one of the constructors, or with a collection of arbitrary size.

Version:
$Revision: 1.2 $

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SimpleList()
          Create the empty list.
SimpleList(Collection c)
          Create an n-tuple of arbitrary size.
SimpleList(Object element)
          Create a singleton list.
SimpleList(Object e1, Object e2)
          Create an ordered pair (2-tuple).
SimpleList(Object e1, Object e2, Object e3)
          Create a 3-tuple.
SimpleList(Object e1, Object e2, Object e3, Object e4)
          Create a 4-tuple.
 
Method Summary
 Object get(int index)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

SimpleList

public SimpleList(Object element)
Create a singleton list.

Parameters:
e1 - The first element.

SimpleList

public SimpleList(Object e1,
                  Object e2)
Create an ordered pair (2-tuple).

Parameters:
e1 - The first element.
e2 - The second element.

SimpleList

public SimpleList(Object e1,
                  Object e2,
                  Object e3)
Create a 3-tuple.

Parameters:
e1 - The first element.
e2 - The second element.
e3 - The third element.

SimpleList

public SimpleList(Object e1,
                  Object e2,
                  Object e3,
                  Object e4)
Create a 4-tuple.

Parameters:
e1 - The first element.
e2 - The second element.
e3 - The third element.
e4 - The fourth element.

SimpleList

public SimpleList()
Create the empty list.


SimpleList

public SimpleList(Collection c)
Create an n-tuple of arbitrary size. Even if the supplied collection has no natural order, the created n-tuple will have the order that the elements are returned by the collection's iterator.

Parameters:
c - The collection.
Method Detail

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

toString

public String toString()
Overrides:
toString in class AbstractCollection

For the latest news and information visit
The GNU Crypto project

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.