org.metastatic.jessie.provider

Class SimpleList


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.1 $

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()

Constructor Details

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.

SimpleList

public SimpleList(Object element)
Create a singleton list.
Parameters:

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.

Method Details

get

public Object get(int index)

size

public int size()

toString

public String toString()