Class MapBackedSet
- java.lang.Object
-
- org.apache.commons.collections.set.MapBackedSet
-
- All Implemented Interfaces:
Serializable
,Iterable
,Collection
,Set
@Deprecated(since="2021-04-30") public final class MapBackedSet extends Object implements Set, Serializable
Deprecated.Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.Decorates aMap
to obtainSet
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 aReferenceMap
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:
- Commons Collections 3.1
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
add(Object obj)
Deprecated.boolean
addAll(Collection coll)
Deprecated.void
clear()
Deprecated.boolean
contains(Object obj)
Deprecated.boolean
containsAll(Collection coll)
Deprecated.static Set
decorate(Map map)
Deprecated.Factory method to create a set from a map.static Set
decorate(Map map, Object dummyValue)
Deprecated.Factory method to create a set from a map.boolean
equals(Object obj)
Deprecated.int
hashCode()
Deprecated.boolean
isEmpty()
Deprecated.Iterator
iterator()
Deprecated.boolean
remove(Object obj)
Deprecated.boolean
removeAll(Collection coll)
Deprecated.boolean
retainAll(Collection coll)
Deprecated.int
size()
Deprecated.Object[]
toArray()
Deprecated.Object[]
toArray(Object[] array)
Deprecated.-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Method Detail
-
decorate
public static Set decorate(Map map)
Deprecated.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
-
decorate
public static Set decorate(Map map, Object dummyValue)
Deprecated.Factory method to create a set from a map.- Parameters:
map
- the map to decorate, must not be nulldummyValue
- the dummy value to use- Throws:
IllegalArgumentException
- if map is null
-
size
public int size()
Deprecated.- Specified by:
size
in interfaceCollection
- Specified by:
size
in interfaceSet
-
isEmpty
public boolean isEmpty()
Deprecated.- Specified by:
isEmpty
in interfaceCollection
- Specified by:
isEmpty
in interfaceSet
-
iterator
public Iterator iterator()
Deprecated.
-
contains
public boolean contains(Object obj)
Deprecated.- Specified by:
contains
in interfaceCollection
- Specified by:
contains
in interfaceSet
-
containsAll
public boolean containsAll(Collection coll)
Deprecated.- Specified by:
containsAll
in interfaceCollection
- Specified by:
containsAll
in interfaceSet
-
add
public boolean add(Object obj)
Deprecated.- Specified by:
add
in interfaceCollection
- Specified by:
add
in interfaceSet
-
addAll
public boolean addAll(Collection coll)
Deprecated.- Specified by:
addAll
in interfaceCollection
- Specified by:
addAll
in interfaceSet
-
remove
public boolean remove(Object obj)
Deprecated.- Specified by:
remove
in interfaceCollection
- Specified by:
remove
in interfaceSet
-
removeAll
public boolean removeAll(Collection coll)
Deprecated.- Specified by:
removeAll
in interfaceCollection
- Specified by:
removeAll
in interfaceSet
-
retainAll
public boolean retainAll(Collection coll)
Deprecated.- Specified by:
retainAll
in interfaceCollection
- Specified by:
retainAll
in interfaceSet
-
clear
public void clear()
Deprecated.- Specified by:
clear
in interfaceCollection
- Specified by:
clear
in interfaceSet
-
toArray
public Object[] toArray()
Deprecated.- Specified by:
toArray
in interfaceCollection
- Specified by:
toArray
in interfaceSet
-
toArray
public Object[] toArray(Object[] array)
Deprecated.- Specified by:
toArray
in interfaceCollection
- Specified by:
toArray
in interfaceSet
-
equals
public boolean equals(Object obj)
Deprecated.
-
-