|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.collections.HashSet<E>
public class HashSet<E>
Implementation of the Set
interface that is backed by a
hash table.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Set |
---|
Set.SetListenerList<E> |
Field Summary | |
---|---|
protected HashMap<E,Void> |
hashMap
|
Constructor Summary | |
---|---|
HashSet()
|
|
HashSet(Comparator<E> comparator)
|
|
HashSet(E... elements)
|
|
HashSet(Set<E> set)
|
Method Summary | |
---|---|
boolean |
add(E element)
Adds an element to the group. |
void |
clear()
Removes all elements from the collection. |
boolean |
contains(E element)
Tests the existence of an element in the group. |
boolean |
equals(Object o)
|
Comparator<E> |
getComparator()
Returns the collection's sort order. |
int |
getCount()
Returns the number of elements in the set. |
ListenerList<SetListener<E>> |
getSetListeners()
Returns the set listener collection. |
int |
hashCode()
|
boolean |
isEmpty()
Tests the emptiness of the collection. |
Iterator<E> |
iterator()
|
boolean |
remove(E element)
Removes an element from the group. |
void |
setComparator(Comparator<E> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected HashMap<E,Void> hashMap
Constructor Detail |
---|
public HashSet()
public HashSet(Set<E> set)
public HashSet(E... elements)
public HashSet(Comparator<E> comparator)
Method Detail |
---|
public boolean add(E element)
Group
add
in interface Group<E>
add
in interface Set<E>
element
- The element to add to the group.
SetListener.elementAdded(Set, Object)
public boolean remove(E element)
Group
remove
in interface Group<E>
remove
in interface Set<E>
element
- The element to remove from the set.
SetListener.elementRemoved(Set, Object)
public void clear()
Collection
clear
in interface Collection<E>
clear
in interface Set<E>
SetListener.setCleared(Set)
public boolean contains(E element)
Group
contains
in interface Group<E>
element
- The element whose presence in the group is to be tested.
public boolean isEmpty()
Collection
isEmpty
in interface Collection<E>
public int getCount()
Set
getCount
in interface Set<E>
public Comparator<E> getComparator()
Collection
getComparator
in interface Collection<E>
Collection.setComparator(Comparator)
public void setComparator(Comparator<E> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<E>
setComparator
in interface Set<E>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.SetListener.setCleared(Set)
public Iterator<E> iterator()
iterator
in interface Iterable<E>
public ListenerList<SetListener<E>> getSetListeners()
Set
getSetListeners
in interface Set<E>
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |