|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jaffa.util.ListSet
This class is backed by an ArrayList. Features are 1) Ensure the Set functionality of unique elements(including a null) in this data structure 2) Iterate through the list in the order in which the entries were made
| Constructor Summary | |
ListSet()
Creates new ListSet |
|
ListSet(Collection c)
Creates new ListSet from an existing Collection. |
|
ListSet(int initialCapacity)
Creates new ListSet specifying the initial capacity. |
|
| Method Summary | |
void |
add(int index,
Object o)
Adds the specified element to this set if it is not already present, at the specified index. |
boolean |
add(Object o)
Adds the specified element to this set if it is not already present. |
boolean |
addAll(Collection c)
Adds all of the elements in the specified collection to this set if they're not already present. |
void |
clear()
Removes all of the elements from this set. |
Object |
clone()
Returns a clone of the Set. |
boolean |
contains(Object o)
Returns true if this set contains the specified element. |
boolean |
containsAll(Collection c)
Returns true if this set contains all of the elements of the specified collection. |
boolean |
equals(Object o)
Compares the specified object with this set for equality. |
Object |
get(int index)
Returns the element from the specified position. |
int |
hashCode()
Returns the hash code value for this set. |
int |
indexOf(Object o)
Returns the index of the element in this set. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
Iterator |
iterator()
Returns an iterator over the elements in this set. |
Object |
remove(int index)
Remove the element from the specified position. |
boolean |
remove(Object o)
Removes the specified element from this set if it is present. |
boolean |
removeAll(Collection c)
Removes from this set all of its elements that are contained in the specified collection. |
boolean |
retainAll(Collection c)
Retains only the elements in this set that are contained in the specified collection. |
int |
size()
Returns the number of elements in this set. |
Object[] |
toArray()
Returns an array containing all of the elements in this set. |
Object[] |
toArray(Object[] a)
Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ListSet()
public ListSet(int initialCapacity)
initialCapacity - The initial capacity.public ListSet(Collection c)
c - An existing collection.| Method Detail |
public boolean retainAll(Collection c)
retainAll in interface Setc - collection that defines which elements this set will retain.
public boolean contains(Object o)
contains in interface Seto - element whose presence in this set is to be tested.
public Object[] toArray()
toArray in interface Setpublic Object[] toArray(Object[] a)
toArray in interface Seta - the array into which the elements of this set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
public Iterator iterator()
iterator in interface Setpublic boolean removeAll(Collection c)
removeAll in interface Setc - collection that defines which elements will be removed from this set.
public boolean remove(Object o)
remove in interface Seto - object to be removed from this set, if present.
public void clear()
clear in interface Setpublic int hashCode()
hashCode in interface Setpublic boolean addAll(Collection c)
addAll in interface Setc - collection whose elements are to be added to this set.
public int size()
size in interface Setpublic boolean containsAll(Collection c)
containsAll in interface Setc - collection to be checked for containment in this set.
public boolean add(Object o)
add in interface Seto - element to be added to this set.
public boolean equals(Object o)
equals in interface Seto - Object to be compared for equality with this set.
public boolean isEmpty()
isEmpty in interface Set
public void add(int index,
Object o)
index - The position at which the element is to be added.o - element to be added to this set.public Object get(int index)
index - The position from which the element is to be retrieved.
public Object remove(int index)
index - The position from which the element is to be removed.
public int indexOf(Object o)
o - The element whose index is to be found.
public Object clone()
throws CloneNotSupportedException
CloneNotSupportedException - if cloning is not supported. Should never happen.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||