|
||||||||||
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<K,V>
public final class MapBackedSet<K,V>
Decorates a Map
to obtain Set
behaviour.
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 V |
dummyValue
The dummyValue to use |
protected Map<K,V> |
map
The map being used as the backing store |
Method Summary | ||
---|---|---|
boolean |
add(K obj)
|
|
boolean |
addAll(Collection<? extends K> coll)
|
|
void |
clear()
|
|
boolean |
contains(Object obj)
|
|
boolean |
containsAll(Collection<?> coll)
|
|
static
|
decorate(Map<K,V> map)
Factory method to create a set from a map. |
|
static
|
decorate(Map<K,V> map,
V dummyValue)
Factory method to create a set from a map. |
|
boolean |
equals(Object obj)
|
|
int |
hashCode()
|
|
boolean |
isEmpty()
|
|
Iterator<K> |
iterator()
|
|
boolean |
remove(Object obj)
|
|
boolean |
removeAll(Collection<?> coll)
|
|
boolean |
retainAll(Collection<?> coll)
|
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] array)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Map<K,V> map
protected final V dummyValue
Method Detail |
---|
public static <K,V> Set<K> decorate(Map<K,V> map)
map
- the map to decorate, must not be null
IllegalArgumentException
- if set is nullpublic static <K,V> Set<K> decorate(Map<K,V> map, V 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 Collection<K>
size
in interface Set<K>
public boolean isEmpty()
isEmpty
in interface Collection<K>
isEmpty
in interface Set<K>
public Iterator<K> iterator()
iterator
in interface Iterable<K>
iterator
in interface Collection<K>
iterator
in interface Set<K>
public boolean contains(Object obj)
contains
in interface Collection<K>
contains
in interface Set<K>
public boolean containsAll(Collection<?> coll)
containsAll
in interface Collection<K>
containsAll
in interface Set<K>
public boolean add(K obj)
add
in interface Collection<K>
add
in interface Set<K>
public boolean addAll(Collection<? extends K> coll)
addAll
in interface Collection<K>
addAll
in interface Set<K>
public boolean remove(Object obj)
remove
in interface Collection<K>
remove
in interface Set<K>
public boolean removeAll(Collection<?> coll)
removeAll
in interface Collection<K>
removeAll
in interface Set<K>
public boolean retainAll(Collection<?> coll)
retainAll
in interface Collection<K>
retainAll
in interface Set<K>
public void clear()
clear
in interface Collection<K>
clear
in interface Set<K>
public Object[] toArray()
toArray
in interface Collection<K>
toArray
in interface Set<K>
public <T> T[] toArray(T[] array)
toArray
in interface Collection<K>
toArray
in interface Set<K>
public boolean equals(Object obj)
equals
in interface Collection<K>
equals
in interface Set<K>
equals
in class Object
public int hashCode()
hashCode
in interface Collection<K>
hashCode
in interface Set<K>
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |