java.lang.Object
java.util.AbstractCollection<E>
org.pcollections.AbstractUnmodifiableCollection<E>
org.pcollections.MapPBag<E>
- Type Parameters:
E-
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,PBag<E>,PCollection<E>
public final class MapPBag<E>
extends AbstractUnmodifiableCollection<E>
implements PBag<E>, Serializable
A map-backed persistent bag.
If the backing map is thread-safe, then this implementation is thread-safe (assuming Java's AbstractCollection is thread-safe), although its iterators may not be.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <E> MapPBag<E>booleaninthashCode()iterator()minusAll(Collection<?> list) plusAll(Collection<? extends E> list) intsize()Methods inherited from class org.pcollections.AbstractUnmodifiableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAllMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
containsAll, isEmpty, parallelStream, removeIf, spliterator, stream, toArray, toArray, toArray
-
Method Details
-
empty
- Type Parameters:
E-- Parameters:
map-- Returns:
- a PBag backed by an empty version of map, i.e. by map.minusAll(map.keySet())
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>- Overrides:
containsin classAbstractCollection<E>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-
equals
- Specified by:
equalsin interfaceCollection<E>- Overrides:
equalsin classObject
-
plus
-
minus
-
plusAll
-
minusAll
-