E - the type of the elements in this setV - the dummy value type in this mappublic final class MapBackedSet<E,V>
extends java.lang.Object
implements java.util.Set<E>, 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(E obj) |
boolean |
addAll(java.util.Collection<? extends E> coll) |
void |
clear() |
boolean |
contains(java.lang.Object obj) |
boolean |
containsAll(java.util.Collection<?> coll) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
static <E,V> MapBackedSet<E,V> |
mapBackedSet(java.util.Map<E,? super V> map)
Factory method to create a set from a map.
|
static <E,V> MapBackedSet<E,V> |
mapBackedSet(java.util.Map<E,? super V> map,
V dummyValue)
Factory method to create a set from a map.
|
boolean |
remove(java.lang.Object obj) |
boolean |
removeAll(java.util.Collection<?> coll) |
boolean |
removeIf(java.util.function.Predicate<? super E> filter) |
boolean |
retainAll(java.util.Collection<?> coll) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
public static <E,V> MapBackedSet<E,V> mapBackedSet(java.util.Map<E,? super V> map)
E - the element typeV - the dummy value type in the mapmap - the map to decorate, must not be nulljava.lang.NullPointerException - if map is nullpublic static <E,V> MapBackedSet<E,V> mapBackedSet(java.util.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 usejava.lang.NullPointerException - if map is nullpublic int size()
public boolean isEmpty()
public java.util.Iterator<E> iterator()
public boolean contains(java.lang.Object obj)
public boolean containsAll(java.util.Collection<?> coll)
public boolean add(E obj)
public boolean addAll(java.util.Collection<? extends E> coll)
public boolean remove(java.lang.Object obj)
public boolean removeIf(java.util.function.Predicate<? super E> filter)
removeIf in interface java.util.Collection<E>public boolean removeAll(java.util.Collection<?> coll)
public boolean retainAll(java.util.Collection<?> coll)
public void clear()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] array)
public boolean equals(java.lang.Object obj)
Copyright © 2010 - 2023 Adobe. All Rights Reserved