- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- org.pcollections.AbstractUnmodifiableCollection<E>
-
- org.pcollections.MapPBag<E>
-
- Type Parameters:
E-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,PBag<E>,PCollection<E>
public final class MapPBag<E> extends AbstractUnmodifiableCollection<E> implements PBag<E>, java.io.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private PMap<E,java.lang.Integer>mapprivate static longserialVersionUIDprivate intsize
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.Object e)private intcount(java.lang.Object o)static <E> MapPBag<E>empty(PMap<E,java.lang.Integer> map)booleanequals(java.lang.Object that)inthashCode()java.util.Iterator<E>iterator()MapPBag<E>minus(java.lang.Object e)MapPBag<E>minusAll(java.util.Collection<?> list)MapPBag<E>plus(E e)MapPBag<E>plusAll(java.util.Collection<? extends E> list)intsize()private static intsize(PMap<?,java.lang.Integer> map)-
Methods inherited from class org.pcollections.AbstractUnmodifiableCollection
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
-
size
private final int size
-
-
Method Detail
-
empty
public static <E> MapPBag<E> empty(PMap<E,java.lang.Integer> map)
- 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()
-
iterator
public java.util.Iterator<E> iterator()
-
contains
public boolean contains(java.lang.Object e)
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<E>- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object that)
- Specified by:
equalsin interfacejava.util.Collection<E>- Overrides:
equalsin classjava.lang.Object
-
count
private int count(java.lang.Object o)
-
size
private static int size(PMap<?,java.lang.Integer> map)
-
-