Class MapMultimap<A,B>
- All Implemented Interfaces:
Multimap<A,,B> Serializable,Iterable<Map.Entry<A,,B>> Collection<Map.Entry<A,,B>> BiPredicate<A,,B> Set<Map.Entry<A,B>>
- Direct Known Subclasses:
HashMultimap
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a pair to this multimap.final booleanThe method uses directly @link{#add(A,B)}.voidclear()booleanWhether this multimap contains a pair with the given components.booleanCreates the preimage.domain()Returns the set of left components of pairs in this multimap.Returns the set of right components of pairs with a given left component in this multimap.imageMap()Returns a map which maps each A which appears as a left component to a set of all B which appear as its right component.iterator()Returns the set of left components of pairs with a given right component in this multimap.Returns a map which maps each B which appears as a right component to a set of all A which appear as its left component.range()Returns the set of right components of pairs in this multimap.booleanRemoves a pair from this this multimap.booleanbooleanremoveAllDomain(Collection<? extends A> c) Removes all pairs with a left component in the given collection from this multimap.booleanremoveAllRange(Collection<? extends B> c) Removes all pairs with a right component in the given collection from this multimap.booleanremoveDomain(A a) Removes all pairs with a given left component from this multimap.booleanremoveRange(B b) Removes all pairs with a given right component from this multimap.booleanretainAllDomain(Collection<? extends A> c) Removes all pairs with a left component which is not the given collection from this multimap.booleanretainAllRange(Collection<? extends B> c) Removes all pairs with a right component which is not the given collection from this multimap.intsize()Methods inherited from class eu.bandm.tools.ops.AbstractMultimap
containsUnchecked, imageAll, imageAllUnchecked, preimageAll, preimageAllUnchecked, removeAllDomainUnchecked, removeAllRangeUnchecked, removeDomainUnchecked, removeRangeUnchecked, removeUnchecked, retainAllDomainUnchecked, retainAllRangeUnchecked, testMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.BiPredicate
and, negate, orMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
forward
-
backward
-
size
protected int size
-
-
Constructor Details
-
MapMultimap
-
-
Method Details
-
createForwardSet
-
createBackwardSet
Creates the preimage. -
add
The method uses directly @link{#add(A,B)}. When a derived class applies checks on the arguments of the add method, these checks are also applied here. -
clear
public void clear() -
contains
-
remove
-
size
public int size() -
iterator
-
add
Description copied from interface:MultimapAdds a pair to this multimap. This operation must be stable: adding a pair thatequalsany pair contained in this multimap componentwise must not change this multimap. -
remove
Description copied from interface:MultimapRemoves a pair from this this multimap. Removing a pair thatequalsno pair contained in this multimap componentwise must not change this multimap. -
removeDomain
Description copied from interface:MultimapRemoves all pairs with a given left component from this multimap. The effect of the implementation on this multimap must be equivalent to the following code:removeDomain(final A a) { for (B b : new HashSet<B>(range())) remove(a, b) ; }- Specified by:
removeDomainin interfaceMultimap<A,B> - Overrides:
removeDomainin classAbstractMultimap<A,B> - Parameters:
a- the left component of all pairs to remove.- Returns:
trueif this multimap has been changed by this operation,falseotherwise.
-
removeRange
Description copied from interface:MultimapRemoves all pairs with a given right component from this multimap. The effect of the implementation on this multimap must be equivalent to the following code:removeRange(final B b) { for (A a : new HashSet<A>(domain())) remove(a, b) ; }- Specified by:
removeRangein interfaceMultimap<A,B> - Overrides:
removeRangein classAbstractMultimap<A,B> - Parameters:
b- the right component of all pairs to remove.- Returns:
trueif this multimap has been changed by this operation,falseotherwise.
-
removeAllDomain
Description copied from interface:MultimapRemoves all pairs with a left component in the given collection from this multimap.- Specified by:
removeAllDomainin interfaceMultimap<A,B> - Overrides:
removeAllDomainin classAbstractMultimap<A,B>
-
retainAllDomain
Description copied from interface:MultimapRemoves all pairs with a left component which is not the given collection from this multimap.- Specified by:
retainAllDomainin interfaceMultimap<A,B> - Overrides:
retainAllDomainin classAbstractMultimap<A,B>
-
removeAllRange
Description copied from interface:MultimapRemoves all pairs with a right component in the given collection from this multimap.- Specified by:
removeAllRangein interfaceMultimap<A,B> - Overrides:
removeAllRangein classAbstractMultimap<A,B>
-
retainAllRange
Description copied from interface:MultimapRemoves all pairs with a right component which is not the given collection from this multimap.- Specified by:
retainAllRangein interfaceMultimap<A,B> - Overrides:
retainAllRangein classAbstractMultimap<A,B>
-
contains
Description copied from interface:MultimapWhether this multimap contains a pair with the given components. -
domain
Description copied from interface:MultimapReturns the set of left components of pairs in this 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
removeDomainoperation, then the returned set and its iterators must support theremoveoperation, and changes by these operations must be reflected by this multimap. -
range
Description copied from interface:MultimapReturns the set of right components of pairs in this multimap.If this multimap supports the
removeRangeoperation, then the returned set and its iterators must support theremoveoperation. -
image
Description copied from interface:MultimapReturns the set of right components of pairs with a given left component in this multimap.The returned set need not be modifiable. The behaviour of this multimap after successfully modifying the returned set is unspecified.
-
imageUnchecked
- Specified by:
imageUncheckedin interfaceMultimap<A,B> - Overrides:
imageUncheckedin classAbstractMultimap<A,B> - See Also:
-
imageMap
Description copied from interface:MultimapReturns a map which maps each A which appears as a left component to a set of all B which appear as its right component. -
preimage
Description copied from interface:MultimapReturns the set of left components of pairs with a given right component in this multimap.The returned set need not be modifiable. The behaviour of this multimap after successfully modifying the returned set is unspecified.
-
preimageUnchecked
- Specified by:
preimageUncheckedin interfaceMultimap<A,B> - Overrides:
preimageUncheckedin classAbstractMultimap<A,B> - See Also:
-
preimageMap
Description copied from interface:MultimapReturns a map which maps each B which appears as a right component to a set of all A which appear as its left component.- Specified by:
preimageMapin interfaceMultimap<A,B> - Overrides:
preimageMapin classAbstractMultimap<A,B>
-