Package eu.bandm.tools.ops
Class UnmodifiableMultimap<A,B>
- All Implemented Interfaces:
Multimap<A,,B> Iterable<Map.Entry<A,,B>> Collection<Map.Entry<A,,B>> BiPredicate<A,,B> Set<Map.Entry<A,B>>
abstract class UnmodifiableMultimap<A,B>
extends AbstractCollection<Map.Entry<A,B>>
implements Multimap<A,B>
A wrapper to protect the contents of an instance of Multimap.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanAdds a pair to this multimap.final booleanWhether this multimap contains a pair with the given components.Returns the set of right components of pairs with a given left component in this multimap.imageAll(Collection<? extends A> c) Returns the set of right components of pairs in this multimap, which have a left component in the given set.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.Returns the set of left components of pairs with a given right component in this multimap.preimageAll(Collection<? extends B> c) Returns the set of left components of pairs in this multimap, which have a right component in the given set.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.final booleanRemoves a pair from this this multimap.final booleanremoveAllDomain(Collection<? extends A> a) Removes all pairs with a left component in the given collection from this multimap.final booleanfinal booleanremoveAllRange(Collection<? extends B> b) Removes all pairs with a right component in the given collection from this multimap.final booleanfinal booleanremoveDomain(A a) Removes all pairs with a given left component from this multimap.final booleanfinal booleanremoveRange(B b) Removes all pairs with a given right component from this multimap.final booleanfinal booleanremoveUnchecked(Object a, Object b) final booleanretainAllDomain(Collection<? extends A> a) Removes all pairs with a left component which is not the given collection from this multimap.final booleanfinal booleanretainAllRange(Collection<? extends B> b) Removes all pairs with a right component which is not the given collection from this multimap.final booleanbooleanMethods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, 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, toArrayMethods inherited from interface eu.bandm.tools.ops.Multimap
containsUnchecked, domain, imageAllUnchecked, imageUnchecked, preimageAllUnchecked, preimageUnchecked, range
-
Constructor Details
-
UnmodifiableMultimap
UnmodifiableMultimap()
-
-
Method Details
-
test
- Specified by:
testin interfaceBiPredicate<A,B>
-
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. -
contains
Description copied from interface:MultimapWhether this multimap contains a pair with the given components. -
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. -
removeUnchecked
- Specified by:
removeUncheckedin interfaceMultimap<A,B> - See Also:
-
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> - Parameters:
a- the left component of all pairs to remove.- Returns:
trueif this multimap has been changed by this operation,falseotherwise.
-
removeDomainUnchecked
- Specified by:
removeDomainUncheckedin interfaceMultimap<A,B>
-
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> - Parameters:
b- the right component of all pairs to remove.- Returns:
trueif this multimap has been changed by this operation,falseotherwise.
-
removeRangeUnchecked
- Specified by:
removeRangeUncheckedin interfaceMultimap<A,B>
-
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>
-
removeAllDomainUnchecked
- Specified by:
removeAllDomainUncheckedin interfaceMultimap<A,B> - See Also:
-
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>
-
retainAllDomainUnchecked
- Specified by:
retainAllDomainUncheckedin interfaceMultimap<A,B> - See Also:
-
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>
-
removeAllRangeUnchecked
- Specified by:
removeAllRangeUncheckedin interfaceMultimap<A,B> - See Also:
-
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>
-
retainAllRangeUnchecked
- Specified by:
retainAllRangeUncheckedin interfaceMultimap<A,B> - See Also:
-
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.
-
imageAll
Description copied from interface:MultimapReturns the set of right components of pairs in this multimap, which have a left component in the given set. -
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.
-
preimageAll
Description copied from interface:MultimapReturns the set of left components of pairs in this multimap, which have a right component in the given set.- Specified by:
preimageAllin interfaceMultimap<A,B>
-
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>
-