dsto.dfc.collections
Class FixedArraySetList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by dsto.dfc.collections.FixedArraySetList
All Implemented Interfaces:
Iterable, Collection, List, Set

public class FixedArraySetList
extends AbstractList
implements List, Set

A wrapper around an array that makes it appear as both an unmodifiable set and an unmodifiable list.

Version:
$Revision$

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
FixedArraySetList(Object[] values)
          Create a set backed by an array of values.
 
Method Summary
 boolean contains(Object o)
           
 Object get(int index)
           
 int indexOf(Object o)
           
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 int size()
           
 Object[] toArray()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, containsAll, equals, hashCode, isEmpty, remove, remove, removeAll, retainAll, set, subList, toArray
 
Methods inherited from interface java.util.Set
add, addAll, clear, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray
 

Constructor Detail

FixedArraySetList

public FixedArraySetList(Object[] values)
Create a set backed by an array of values. The values must not contain duplicates.

Method Detail

get

public Object get(int index)
Specified by:
get in interface List
Specified by:
get in class AbstractList

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List
Overrides:
indexOf in class AbstractList

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List
Overrides:
lastIndexOf in class AbstractList

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List
Overrides:
listIterator in class AbstractList

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List
Overrides:
listIterator in class AbstractList

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Specified by:
iterator in interface Set
Overrides:
iterator in class AbstractList

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in interface Set
Specified by:
size in class AbstractCollection

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List
Specified by:
contains in interface Set
Overrides:
contains in class AbstractCollection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Specified by:
toArray in interface Set
Overrides:
toArray in class AbstractCollection


Copyright © 2008 Commonwealth of Australia