public final class

MapBackedSet

extends Object
implements Serializable Set<E>
java.lang.Object
   ↳ org.apache.commons.collections.set.MapBackedSet

Class Overview

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.

Summary

Fields
protected final Object dummyValue The dummyValue to use
protected final Map map The map being used as the backing store
Public Methods
boolean add(Object obj)
boolean addAll(Collection coll)
void clear()
boolean contains(Object obj)
boolean containsAll(Collection coll)
static Set decorate(Map map, Object dummyValue)
Factory method to create a set from a map.
static Set decorate(Map map)
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)
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Fields

protected final Object dummyValue

The dummyValue to use

protected final Map map

The map being used as the backing store

Public Methods

public boolean add (Object obj)

public boolean addAll (Collection coll)

public void clear ()

public boolean contains (Object obj)

public boolean containsAll (Collection coll)

public static Set decorate (Map map, Object dummyValue)

Factory method to create a set from a map.

Parameters
map the map to decorate, must not be null
dummyValue the dummy value to use
Throws
IllegalArgumentException if map is null

public static Set decorate (Map map)

Factory method to create a set from a map.

Parameters
map the map to decorate, must not be null
Throws
IllegalArgumentException if set is null

public boolean equals (Object obj)

public int hashCode ()

public boolean isEmpty ()

public Iterator iterator ()

public boolean remove (Object obj)

public boolean removeAll (Collection coll)

public boolean retainAll (Collection coll)

public int size ()

public Object[] toArray ()

public Object[] toArray (Object[] array)