com.croftsoft.core.util
Class SetList

java.lang.Object
  extended by com.croftsoft.core.util.SetList
All Implemented Interfaces:
Iterable, Collection, List, Set

public class SetList
extends Object
implements Set, List

A List that, like a Set, contains no duplicate Elements.

Version:
1998-11-23
Author:
David Wallace Croft

Field Summary
protected  List list
           
 
Constructor Summary
SetList(List list)
           
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
          Returns false if the List already contains the object.
 boolean addAll(Collection c)
          Skips objects in the Collection that already exist in the List.
 boolean addAll(int index, Collection c)
          Skips object in the Collection that already exist in the List.
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object o)
           
 Object get(int index)
           
 int hashCode()
           
 int indexOf(Object o)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
           
 int size()
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected List list
Constructor Detail

SetList

public SetList(List list)
Method Detail

add

public boolean add(Object o)
Returns false if the List already contains the object.

Specified by:
add in interface Collection
Specified by:
add in interface List
Specified by:
add in interface Set

addAll

public boolean addAll(Collection c)
Skips objects in the Collection that already exist in the List. Returns true if any of the objects were added.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Specified by:
addAll in interface Set

addAll

public boolean addAll(int index,
                      Collection c)
Skips object in the Collection that already exist in the List. Returns true if any of the objects were added.

Specified by:
addAll in interface List

set

public Object set(int index,
                  Object element)
Specified by:
set in interface List
Throws:
IllegalArgumentException - If a duplicate object already exists in the List.

add

public void add(int index,
                Object element)
Specified by:
add in interface List
Throws:
IllegalArgumentException - If a duplicate object already exists in the List.

size

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

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List
Specified by:
isEmpty in interface Set

contains

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

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

toArray

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

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Specified by:
toArray in interface Set

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection
Specified by:
remove in interface List
Specified by:
remove in interface Set

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List
Specified by:
containsAll in interface Set

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Specified by:
removeAll in interface Set

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Specified by:
retainAll in interface Set

clear

public void clear()
Specified by:
clear in interface Collection
Specified by:
clear in interface List
Specified by:
clear in interface Set

equals

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

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface List
Specified by:
hashCode in interface Set
Overrides:
hashCode in class Object

get

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

remove

public Object remove(int index)
Specified by:
remove in interface List

indexOf

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

lastIndexOf

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

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

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

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)