org.apache.commons.collections.set
Class MapBackedSet
java.lang.Object
org.apache.commons.collections.set.MapBackedSet
- Serializable, Set
public final class MapBackedSet
extends java.lang.Object
implements Set, Serializable
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.
$Revision: 1.2 $ $Date: 2004/06/02 22:00:47 $protected Object | dummyValue - The dummyValue to use
|
protected Map | map - The map being used as the backing store
|
dummyValue
protected final Object dummyValue
The dummyValue to use
map
protected final Map map
The map being used as the backing store
add
public boolean add(Object obj)
addAll
public boolean addAll(Collection coll)
contains
public boolean contains(Object obj)
containsAll
public boolean containsAll(Collection coll)
decorate
public static Set decorate(Map map)
Factory method to create a set from a map.
map
- the map to decorate, must not be null
decorate
public static Set decorate(Map map,
Object dummyValue)
Factory method to create a set from a map.
map
- the map to decorate, must not be nulldummyValue
- the dummy value to use
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
isEmpty
public boolean isEmpty()
iterator
public Iterator iterator()
remove
public boolean remove(Object obj)
removeAll
public boolean removeAll(Collection coll)
retainAll
public boolean retainAll(Collection coll)
toArray
public Object[] toArray()
toArray
public Object[] toArray(Object[] array)
Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.