org.apache.commons.collections.set
public final class MapBackedSet extends Object implements Set, Serializable
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.
Since: Commons Collections 3.1
Version: $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
| 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) |
Parameters: map the map to decorate, must not be null
Throws: IllegalArgumentException if set is null
Parameters: map the map to decorate, must not be null dummyValue the dummy value to use
Throws: IllegalArgumentException if map is null