|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.collections.set.MapBackedSet
Decorates a Map to obtain Set behaviour.
This class is used to create a Set with the same properties as
the key set of any map. Thus, a ReferenceSet can be created by wrapping a
ReferenceMap in an instance of this class.
Most map implementation can be used to create a set by passing in dummy values.
Exceptions include BidiMap implementations, as they require unique values.
| Field Summary | |
protected Object |
dummyValue
The dummyValue to use |
protected Map |
map
The map being used as the backing store |
| Method Summary | |
boolean |
add(Object obj)
|
boolean |
addAll(Collection coll)
|
void |
clear()
|
boolean |
contains(Object obj)
|
boolean |
containsAll(Collection coll)
|
static Set |
decorate(Map map)
Factory method to create a set from a map. |
static Set |
decorate(Map map,
Object dummyValue)
Factory method to create a set from a map. |
boolean |
equals(Object obj)
|
int |
hashCode()
|
boolean |
isEmpty()
|
Iterator |
iterator()
|
boolean |
remove(Object obj)
|
boolean |
removeAll(Collection coll)
|
boolean |
retainAll(Collection coll)
|
int |
size()
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] array)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final Map map
protected final Object dummyValue
| Method Detail |
public static Set decorate(Map map)
map - the map to decorate, must not be null
IllegalArgumentException - if set is null
public static Set decorate(Map map,
Object dummyValue)
map - the map to decorate, must not be nulldummyValue - the dummy value to use
IllegalArgumentException - if map is nullpublic int size()
size in interface Setpublic boolean isEmpty()
isEmpty in interface Setpublic Iterator iterator()
iterator in interface Setpublic boolean contains(Object obj)
contains in interface Setpublic boolean containsAll(Collection coll)
containsAll in interface Setpublic boolean add(Object obj)
add in interface Setpublic boolean addAll(Collection coll)
addAll in interface Setpublic boolean remove(Object obj)
remove in interface Setpublic boolean removeAll(Collection coll)
removeAll in interface Setpublic boolean retainAll(Collection coll)
retainAll in interface Setpublic void clear()
clear in interface Setpublic Object[] toArray()
toArray in interface Setpublic Object[] toArray(Object[] array)
toArray in interface Setpublic boolean equals(Object obj)
equals in interface Setpublic int hashCode()
hashCode in interface Set
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||