net.sf.swan.util
Class SingletonList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--net.sf.swan.util.SingletonList
All Implemented Interfaces:
java.util.Collection, java.util.List

public final class SingletonList
extends java.util.AbstractList

A recyclable singleton list. Unlike the adapter provided by the Collections class, one may reset it's single value and keep reusing the same List.


Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SingletonList()
           
SingletonList(java.lang.Object element)
           
 
Method Summary
 java.lang.Object get(int index)
           
 java.lang.Object set(int index, java.lang.Object element)
           
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
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

SingletonList

public SingletonList()

SingletonList

public SingletonList(java.lang.Object element)
Method Detail

get

public java.lang.Object get(int index)
Overrides:
get in class java.util.AbstractList

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Overrides:
set in class java.util.AbstractList

size

public int size()
Overrides:
size in class java.util.AbstractCollection