Package eu.bandm.tools.util.multi
Class HashMultimap<A,B>
java.lang.Object
eu.bandm.tools.util.multi.MapMultimap<A,B>
eu.bandm.tools.util.multi.HashMultimap<A,B>
- Type Parameters:
A
- type of the domain elementsB
- type of the range elements
- 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>>
An Implementation where both directions of look-up are realized by
hashing.
- See Also:
-
Field Summary
Fields inherited from class eu.bandm.tools.util.multi.MapMultimap
backward, forward, size
Fields inherited from interface eu.bandm.tools.util.multi.Multimap
DEFAULT_PAIR_FORMAT_STRING
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty multimap.HashMultimap
(HashMultimap<A, B> r) Constructs a multimap which is a copy of the given multimap.HashMultimap
(Collection<? extends Map.Entry<A, B>> c) Constructs a multimap which contains all pairs given in the argument.HashMultimap
(Map<A, B> m) Constructs a multimap which contains all pairs given in the argument. -
Method Summary
Modifier and TypeMethodDescriptionCreates the preimage set for every range element added.Creates the image set for every domain element added.Methods inherited from class eu.bandm.tools.util.multi.MapMultimap
add, add, clear, contains, contains, domain, image, imageMap, imageUnchecked, isEmpty, iterator, preimage, preimageMap, preimageUnchecked, range, remove, remove, removeAllDomain, removeAllRange, removeDomain, removeRange, retainAllDomain, retainAllRange, size, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.function.BiPredicate
and, negate, or
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface eu.bandm.tools.util.multi.Multimap
addAll, containsAll, containsUnchecked, imageAll, imageAllUnchecked, preimageAll, preimageAllUnchecked, removeAll, removeAllDomainUnchecked, removeAllRangeUnchecked, removeDomainUnchecked, removeRangeUnchecked, removeUnchecked, retainAll, retainAllDomainUnchecked, retainAllRangeUnchecked, test, toArray, toArray, toString, toString
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Constructor Details
-
HashMultimap
public HashMultimap()Constructs an empty multimap. -
HashMultimap
Constructs a multimap which contains all pairs given in the argument. Both collections will be independent.(Subclasses must avoid this-escape:
Multimap.addAll(java.util.Collection<? extends java.util.Map.Entry<A, B>>)
is invoked.)- Parameters:
c
- the pairs to include in the constructed multimap
-
HashMultimap
Constructs a multimap which contains all pairs given in the argument. Both collections will be independent.- Parameters:
m
- the pairs to include in the constructed multimap
-
HashMultimap
Constructs a multimap which is a copy of the given multimap. Both multimaps will be independent.- Parameters:
r
- the pairs to include in the constructed multimap
-
-
Method Details
-
createForwardSet
Creates the image set for every domain element added.Subclasses implementing this method must ensure that when the map A->Set<B> is sorted, then this set also is.
This class creates
HashMap
s.- Specified by:
createForwardSet
in classMapMultimap<A,
B> - Returns:
- a sets for range domain elements assigned to one particular domain element.
-
createBackwardSet
Creates the preimage set for every range element added.Subclasses implementing this method must ensure that when the map B->Set<A> is sorted, then this set also is.
This class creates
HashMap
s.- Specified by:
createBackwardSet
in classMapMultimap<A,
B> - Returns:
- a sets for the domain elements assigned to one particular range element.
-