|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.util.StableHashSet
This version of a HashSet keeps the order of its elements.
This is different from the original Java 1.3 HashSet that
imposes no order on its elements.
The order of the values in the StableHashSet is stable and
does not change throughout the lifetime of the set.
The class also allows to remove a value from the order and bring it to front
or to the back of the order in linear time.
Methods for reordering are
reorderToBack(Object) and reorderToFront(Object).
| Constructor Summary | |
StableHashSet()
Constructs a new empty StableHashSet. |
|
StableHashSet(java.util.Collection collection)
Constructs a empty StableHashSet filled with the
item from the passed Collection. |
|
StableHashSet(int initialCapacity)
Constructs a new empty StableHashSet with the given
initial capacity. |
|
| Method Summary | |
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
void |
clear()
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
reorderToBack(java.lang.Object key)
Brings the object with the associated key to the end of the internal order. |
boolean |
reorderToFront(java.lang.Object key)
Brings the object with the associated key to the beginning of the internal order. |
boolean |
retainAll(java.util.Collection c)
|
int |
size()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Set |
equals, hashCode |
| Constructor Detail |
public StableHashSet()
StableHashSet.
public StableHashSet(int initialCapacity)
StableHashSet with the given
initial capacity.
initialCapacity - the initial capacity of this
StableHashSet instance.public StableHashSet(java.util.Collection collection)
StableHashSet filled with the
item from the passed Collection.
collection - initial items.| Method Detail |
public boolean reorderToFront(java.lang.Object key)
key - the key that identifies the element to reorder.
public boolean reorderToBack(java.lang.Object key)
key - the key that identifies the element to reorder.
public boolean add(java.lang.Object o)
add in interface java.util.Setpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.Setpublic void clear()
clear in interface java.util.Setpublic boolean contains(java.lang.Object o)
contains in interface java.util.Setpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.Setpublic boolean isEmpty()
isEmpty in interface java.util.Setpublic java.util.Iterator iterator()
iterator in interface java.util.Setpublic boolean remove(java.lang.Object o)
remove in interface java.util.Setpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Setpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Setpublic int size()
size in interface java.util.Setpublic java.lang.Object[] toArray()
toArray in interface java.util.Setpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.Set
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||