- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.pcollections.AbstractUnmodifiableSet<E>
-
- org.pcollections.MapPSet<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
,PCollection<E>
,PSet<E>
public final class MapPSet<E> extends AbstractUnmodifiableSet<E> implements PSet<E>, java.io.Serializable
A map-backed persistent set.If the backing map is thread-safe, then this implementation is thread-safe (assuming Java's AbstractSet is thread-safe), although its iterators may not be.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MapPSet.In
-
Field Summary
Fields Modifier and Type Field Description private PMap<E,java.lang.Object>
map
private static long
serialVersionUID
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.Object e)
static <E> MapPSet<E>
from(PMap<E,?> map)
static <E> MapPSet<E>
from(PMap<E,?> map, E e)
static <E> MapPSet<E>
from(PMap<E,?> map, java.util.Collection<? extends E> list)
MapPSet<E>
intersect(java.util.Collection<? extends E> list)
java.util.Iterator<E>
iterator()
MapPSet<E>
minus(java.lang.Object e)
MapPSet<E>
minusAll(java.util.Collection<?> list)
MapPSet<E>
plus(E e)
MapPSet<E>
plusAll(java.util.Collection<? extends E> list)
int
size()
-
Methods inherited from class org.pcollections.AbstractUnmodifiableSet
add, addAll, clear, remove, removeAll, removeIf, retainAll
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
from
public static <E> MapPSet<E> from(PMap<E,?> map)
- Type Parameters:
E
-- Parameters:
map
-- Returns:
- a PSet with the elements of map.keySet(), backed by map
-
from
public static <E> MapPSet<E> from(PMap<E,?> map, E e)
- Type Parameters:
E
-- Parameters:
map
-e
-- Returns:
- from(map).plus(e)
-
from
public static <E> MapPSet<E> from(PMap<E,?> map, java.util.Collection<? extends E> list)
- Type Parameters:
E
-- Parameters:
map
-list
-- Returns:
- from(map).plusAll(list)
-
iterator
public java.util.Iterator<E> iterator()
-
size
public int size()
-
contains
public boolean contains(java.lang.Object e)
-
-