|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.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 nullpublic 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 Set
public boolean isEmpty()
isEmpty
in interface Set
public Iterator iterator()
iterator
in interface Set
public boolean contains(Object obj)
contains
in interface Set
public boolean containsAll(Collection coll)
containsAll
in interface Set
public boolean add(Object obj)
add
in interface Set
public boolean addAll(Collection coll)
addAll
in interface Set
public boolean remove(Object obj)
remove
in interface Set
public boolean removeAll(Collection coll)
removeAll
in interface Set
public boolean retainAll(Collection coll)
retainAll
in interface Set
public void clear()
clear
in interface Set
public Object[] toArray()
toArray
in interface Set
public Object[] toArray(Object[] array)
toArray
in interface Set
public boolean equals(Object obj)
equals
in interface Set
equals
in class Object
public int hashCode()
hashCode
in interface Set
hashCode
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |