|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections.set.MapBackedSet
public final class 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 java.lang.Object |
dummyValue
The dummyValue to use |
protected java.util.Map |
map
The map being used as the backing store |
| Method Summary | |
|---|---|
boolean |
add(java.lang.Object obj)
|
boolean |
addAll(java.util.Collection coll)
|
void |
clear()
|
boolean |
contains(java.lang.Object obj)
|
boolean |
containsAll(java.util.Collection coll)
|
static java.util.Set |
decorate(java.util.Map map)
Factory method to create a set from a map. |
static java.util.Set |
decorate(java.util.Map map,
java.lang.Object dummyValue)
Factory method to create a set from a map. |
boolean |
equals(java.lang.Object obj)
|
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
boolean |
remove(java.lang.Object obj)
|
boolean |
removeAll(java.util.Collection coll)
|
boolean |
retainAll(java.util.Collection coll)
|
int |
size()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] array)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.Map map
protected final java.lang.Object dummyValue
| Method Detail |
|---|
public static java.util.Set decorate(java.util.Map map)
map - the map to decorate, must not be null
java.lang.IllegalArgumentException - if set is null
public static java.util.Set decorate(java.util.Map map,
java.lang.Object dummyValue)
map - the map to decorate, must not be nulldummyValue - the dummy value to use
java.lang.IllegalArgumentException - if map is nullpublic int size()
size in interface java.util.Collectionsize in interface java.util.Setpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Setpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Setpublic boolean contains(java.lang.Object obj)
contains in interface java.util.Collectioncontains in interface java.util.Setpublic boolean containsAll(java.util.Collection coll)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Setpublic boolean add(java.lang.Object obj)
add in interface java.util.Collectionadd in interface java.util.Setpublic boolean addAll(java.util.Collection coll)
addAll in interface java.util.CollectionaddAll in interface java.util.Setpublic boolean remove(java.lang.Object obj)
remove in interface java.util.Collectionremove in interface java.util.Setpublic boolean removeAll(java.util.Collection coll)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Setpublic boolean retainAll(java.util.Collection coll)
retainAll in interface java.util.CollectionretainAll in interface java.util.Setpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Setpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic java.lang.Object[] toArray(java.lang.Object[] array)
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Collectionequals in interface java.util.Setequals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.SethashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||