public abstract class MapMultimap<A,B> extends AbstractMultimap<A,B>
Modifier and Type | Field and Description |
---|---|
protected Map<B,Set<A>> |
backward |
protected Map<A,Set<B>> |
forward |
protected int |
size |
Modifier | Constructor and Description |
---|---|
protected |
MapMultimap(Map<A,Set<B>> forward,
Map<B,Set<A>> backward,
int size) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(A a,
B b)
Adds a pair to this this multimap.
|
boolean |
add(Map.Entry<A,B> e)
The method uses directly @link{#add(A,B)}.
|
void |
clear() |
boolean |
contains(A a,
B b) |
boolean |
contains(Object o) |
protected abstract Set<A> |
createBackwardSet() |
protected abstract Set<B> |
createForwardSet() |
Set<A> |
domain()
Returns the set of left components of pairs in this multimap.
|
Set<B> |
image(A a)
Returns the set of right components of pairs with a given left
component in this multimap.
|
Map<A,Set<B>> |
imageMap() |
Set<B> |
imageUnchecked(Object a) |
Iterator<Map.Entry<A,B>> |
iterator() |
Set<A> |
preimage(B b)
Returns the set of left components of pairs with a given right
component in this multimap.
|
Map<B,Set<A>> |
preimageMap() |
Set<A> |
preimageUnchecked(Object b) |
Set<B> |
range()
Returns the set of right components of pairs in this multimap.
|
boolean |
remove(A a,
B b)
Removes a pair from this this multimap.
|
boolean |
remove(Object o) |
boolean |
removeAllDomain(Collection<? extends A> c) |
boolean |
removeAllRange(Collection<? extends B> c) |
boolean |
removeDomain(A a)
Removes all pairs with a given left component from this
multimap.
|
boolean |
removeRange(B b)
Removes all pairs with a given right component from this
multimap.
|
boolean |
retainAllDomain(Collection<? extends A> c) |
boolean |
retainAllRange(Collection<? extends B> c) |
int |
size() |
containsUnchecked, imageAll, imageAllUnchecked, preimageAll, preimageAllUnchecked, relates, removeAllDomainUnchecked, removeAllRangeUnchecked, removeDomainUnchecked, removeRangeUnchecked, removeUnchecked, retainAllDomainUnchecked, retainAllRangeUnchecked
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public final boolean add(Map.Entry<A,B> e)
public void clear()
public boolean contains(Object o)
public boolean remove(Object o)
public int size()
public boolean add(A a, B b)
Multimap
equals
any pair contained in
this multimap componentwise must not change this multimap.public boolean remove(A a, B b)
Multimap
equals
no pair contained in this multimap componentwise
must not change this multimap.public boolean removeDomain(A a)
Multimap
removeDomain(final A a) { for (B b : new HashSet<B>(range())) remove(a, b) ; }
removeDomain
in interface Multimap<A,B>
removeDomain
in class AbstractMultimap<A,B>
a
- the left component of all pairs to remove.true
if this multimap has been changed by this
operation, false
otherwise.public boolean removeRange(B b)
Multimap
removeRange(final B b) { for (A a : new HashSet<A>(domain())) remove(a, b) ; }
removeRange
in interface Multimap<A,B>
removeRange
in class AbstractMultimap<A,B>
b
- the right component of all pairs to remove.true
if this multimap has been changed by this
operation, false
otherwise.public boolean removeAllDomain(Collection<? extends A> c)
removeAllDomain
in interface Multimap<A,B>
removeAllDomain
in class AbstractMultimap<A,B>
public boolean retainAllDomain(Collection<? extends A> c)
retainAllDomain
in interface Multimap<A,B>
retainAllDomain
in class AbstractMultimap<A,B>
public boolean removeAllRange(Collection<? extends B> c)
removeAllRange
in interface Multimap<A,B>
removeAllRange
in class AbstractMultimap<A,B>
public boolean retainAllRange(Collection<? extends B> c)
retainAllRange
in interface Multimap<A,B>
retainAllRange
in class AbstractMultimap<A,B>
public Set<A> domain()
Multimap
The returned set is backed by this multimap, such that changes to this multimap are reflected by the set. The behavior of modifications of this multimap concurrent to iteration of the set is unspecified.
If this multimap supports the removeDomain
operation,
then the returned set and its iterators must support the remove
operation, and changes by these operations must be
reflected by this multimap.
public Set<B> range()
Multimap
If this multimap supports the removeRange
operation,
then the returned set and its iterators must support the remove
operation.
public Set<B> image(A a)
Multimap
The returned set need not be modifiable. The behaviour of this multimap after successfully modifying the returned set is unspecified.
public Set<B> imageUnchecked(Object a)
imageUnchecked
in interface Multimap<A,B>
imageUnchecked
in class AbstractMultimap<A,B>
public Set<A> preimage(B b)
Multimap
The returned set need not be modifiable. The behaviour of this multimap after successfully modifying the returned set is unspecified.
public Set<A> preimageUnchecked(Object b)
preimageUnchecked
in interface Multimap<A,B>
preimageUnchecked
in class AbstractMultimap<A,B>
public Map<B,Set<A>> preimageMap()
preimageMap
in interface Multimap<A,B>
preimageMap
in class AbstractMultimap<A,B>
see also the complete user documentation .