Class MapBackedSet<E,V> 
java.lang.Object
org.apache.commons.collections4.set.MapBackedSet<E,V> 
- Type Parameters:
- E- the type of the elements in this set
- V- the dummy value type in this map
- All Implemented Interfaces:
- Serializable,- Iterable<E>,- Collection<E>,- Set<E>
Decorates a 
Map to obtain Set behavior.
 
 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:
- 3.1
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> coll) voidclear()booleanbooleancontainsAll(Collection<?> coll) booleaninthashCode()booleanisEmpty()iterator()static <E,V> MapBackedSet <E, V> mapBackedSet(Map<E, ? super V> map) Factory method to create a set from a map.static <E,V> MapBackedSet <E, V> mapBackedSet(Map<E, ? super V> map, V dummyValue) Factory method to create a set from a map.booleanbooleanremoveAll(Collection<?> coll) booleanbooleanretainAll(Collection<?> coll) intsize()Object[]toArray()<T> T[]toArray(T[] array) Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, streamMethods inherited from interface java.util.Setspliterator
- 
Method Details- 
mapBackedSetFactory method to create a set from a map.- Type Parameters:
- E- the element type
- V- the dummy value type in the map
- Parameters:
- map- the map to decorate, must not be null
- Returns:
- a new map backed set
- Throws:
- NullPointerException- if map is null
- Since:
- 4.0
 
- 
mapBackedSetFactory method to create a set from a map.- Type Parameters:
- E- the element type
- V- the dummy value type in the map
- Parameters:
- map- the map to decorate, must not be null
- dummyValue- the dummy value to use
- Returns:
- a new map backed set
- Throws:
- NullPointerException- if map is null
- Since:
- 4.0
 
- 
add
- 
addAll
- 
clear
- 
contains
- 
containsAll- Specified by:
- containsAllin interface- Collection<E>
- Specified by:
- containsAllin interface- Set<E>
 
- 
equals
- 
hashCode
- 
isEmpty
- 
iterator
- 
remove
- 
removeAll
- 
removeIf
- 
retainAll
- 
size
- 
toArray
- 
toArray
 
-