|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.set.MapBackedSet<E,V>
public final class MapBackedSet<E,V>
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.
Method Summary | ||
---|---|---|
boolean |
add(E obj)
|
|
boolean |
addAll(Collection<? extends E> coll)
|
|
void |
clear()
|
|
boolean |
contains(Object obj)
|
|
boolean |
containsAll(Collection<?> coll)
|
|
boolean |
equals(Object obj)
|
|
int |
hashCode()
|
|
boolean |
isEmpty()
|
|
Iterator<E> |
iterator()
|
|
static
|
mapBackedSet(Map<E,? super V> map)
Factory method to create a set from a map. |
|
static
|
mapBackedSet(Map<E,? super V> map,
V dummyValue)
Factory method to create a set from a map. |
|
boolean |
remove(Object obj)
|
|
boolean |
removeAll(Collection<?> coll)
|
|
boolean |
retainAll(Collection<?> coll)
|
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] array)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <E,V> MapBackedSet<E,V> mapBackedSet(Map<E,? super V> map)
E
- the element typeV
- the dummy value type in the mapmap
- the map to decorate, must not be null
IllegalArgumentException
- if set is nullpublic static <E,V> MapBackedSet<E,V> mapBackedSet(Map<E,? super V> map, V dummyValue)
E
- the element typeV
- the dummy value type in the mapmap
- the map to decorate, must not be nulldummyValue
- the dummy value to use
IllegalArgumentException
- if map is nullpublic int size()
size
in interface Collection<E>
size
in interface Set<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in interface Set<E>
public boolean contains(Object obj)
contains
in interface Collection<E>
contains
in interface Set<E>
public boolean containsAll(Collection<?> coll)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean add(E obj)
add
in interface Collection<E>
add
in interface Set<E>
public boolean addAll(Collection<? extends E> coll)
addAll
in interface Collection<E>
addAll
in interface Set<E>
public boolean remove(Object obj)
remove
in interface Collection<E>
remove
in interface Set<E>
public boolean removeAll(Collection<?> coll)
removeAll
in interface Collection<E>
removeAll
in interface Set<E>
public boolean retainAll(Collection<?> coll)
retainAll
in interface Collection<E>
retainAll
in interface Set<E>
public void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface Set<E>
public <T> T[] toArray(T[] array)
toArray
in interface Collection<E>
toArray
in interface Set<E>
public boolean equals(Object obj)
equals
in interface Collection<E>
equals
in interface Set<E>
equals
in class Object
public int hashCode()
hashCode
in interface Collection<E>
hashCode
in interface Set<E>
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |