public final class MapBackedSet
extends java.lang.Object
implements java.util.Set, java.io.Serializable
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.
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object obj) |
boolean |
addAll(java.util.Collection coll) |
void |
clear() |
boolean |
contains(java.lang.Object obj) |
boolean |
containsAll(java.util.Collection coll) |
static java.util.Set |
decorate(java.util.Map map)
Factory method to create a set from a map.
|
static java.util.Set |
decorate(java.util.Map map,
java.lang.Object dummyValue)
Factory method to create a set from a map.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator |
iterator() |
boolean |
remove(java.lang.Object obj) |
boolean |
removeAll(java.util.Collection coll) |
boolean |
retainAll(java.util.Collection coll) |
int |
size() |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] array) |
public static java.util.Set decorate(java.util.Map map)
map
- the map to decorate, must not be nulljava.lang.IllegalArgumentException
- if set is nullpublic static java.util.Set decorate(java.util.Map map, java.lang.Object dummyValue)
map
- the map to decorate, must not be nulldummyValue
- the dummy value to usejava.lang.IllegalArgumentException
- if map is nullpublic int size()
size
in interface java.util.Collection
size
in interface java.util.Set
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.Set
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.Set
public boolean contains(java.lang.Object obj)
contains
in interface java.util.Collection
contains
in interface java.util.Set
public boolean containsAll(java.util.Collection coll)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
public boolean add(java.lang.Object obj)
add
in interface java.util.Collection
add
in interface java.util.Set
public boolean addAll(java.util.Collection coll)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
public boolean remove(java.lang.Object obj)
remove
in interface java.util.Collection
remove
in interface java.util.Set
public boolean removeAll(java.util.Collection coll)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
public boolean retainAll(java.util.Collection coll)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] array)
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection
equals
in interface java.util.Set
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Collection
hashCode
in interface java.util.Set
hashCode
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved