Package io.vavr.collection
Class TreeMultimap<K,V>
java.lang.Object
io.vavr.collection.AbstractMultimap<K,V,TreeMultimap<K,V>>
io.vavr.collection.TreeMultimap<K,V>
- Type Parameters:
K
- Key typeV
- Value type
- All Implemented Interfaces:
Foldable<Tuple2<K,
,V>> Multimap<K,
,V> Ordered<K>
,SortedMultimap<K,
,V> Traversable<Tuple2<K,
,V>> Function1<K,
,Traversable<V>> PartialFunction<K,
,Traversable<V>> Value<Tuple2<K,
,V>> Serializable
,Iterable<Tuple2<K,
,V>> Function<K,
Traversable<V>>
public final class TreeMultimap<K,V>
extends AbstractMultimap<K,V,TreeMultimap<K,V>>
implements Serializable, SortedMultimap<K,V>
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.vavr.collection.AbstractMultimap
AbstractMultimap.SerializableSupplier<T>
Nested classes/interfaces inherited from interface io.vavr.collection.Multimap
Multimap.ContainerType
-
Field Summary
FieldsFields inherited from class io.vavr.collection.AbstractMultimap
back, emptyContainer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TreeMultimap
(Map<K, Traversable<V>> back, Multimap.ContainerType containerType, AbstractMultimap.SerializableSupplier<Traversable<?>> emptyContainer) -
Method Summary
Modifier and TypeMethodDescriptionReturns the comparator which defines the order of the elements contained in this collection.protected <K2,
V2> TreeMultimap <K2, V2> createFromMap
(Map<K2, Traversable<V2>> back) protected <K2,
V2> TreeMultimap <K2, V2> protected <K2,
V2> Map <K2, V2> keySet()
Returns the keys contained in this multimap.static <K,
V> TreeMultimap <K, V> narrow
(TreeMultimap<? extends K, ? extends V> map) Narrows a widenedHashMultimap<? extends K, ? extends V>
toHashMultimap<K, V>
by performing a type safe-cast.Converts this VavrMap
to ajava.util.Map
while preserving characteristics like insertion order (LinkedHashMultimap
) and sort order (SortedMultimap
).static <V> TreeMultimap.Builder
<V> withSeq()
static <V> TreeMultimap.Builder
<V> withSet()
static <V extends Comparable<?>>
TreeMultimap.Builder<V> static <V> TreeMultimap.Builder
<V> withSortedSet
(Comparator<? super V> comparator) Methods inherited from class io.vavr.collection.AbstractMultimap
asMap, bimap, containsKey, distinct, distinctBy, distinctBy, drop, dropRight, dropUntil, dropWhile, equals, filter, filter, filterKeys, filterValues, flatMap, get, getContainerType, getOrElse, groupBy, grouped, hashCode, head, init, initOption, isAsync, isEmpty, isLazy, iterator, last, map, mapValues, merge, merge, orElse, orElse, partition, peek, put, put, reject, reject, rejectKeys, rejectValues, remove, remove, removeAll, removeAll, removeKeys, removeValues, replace, replace, replaceAll, replaceAll, replaceValue, retainAll, scan, size, slideBy, sliding, sliding, span, stringPrefix, tail, tailOption, take, takeRight, takeUntil, takeWhile, toJavaMap, toString, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.vavr.collection.Foldable
fold, reduce, reduceOption
Methods inherited from interface io.vavr.Function1
andThen, arity, compose, curried, isMemoized, memoized, partial, reversed, tupled
Methods inherited from interface io.vavr.collection.Multimap
apply, asMap, asPartialFunction, bimap, collect, contains, containsKey, containsValue, flatMap, flatMap, foldRight, forEach, get, getContainerType, getOrElse, hasDefiniteSize, isDefinedAt, isDistinct, isTraversableAgain, iterator, iterator, length, map, map, mapValues, scanLeft, scanRight, size, transform, unzip, unzip, unzip3, unzip3, values, zip, zipAll, zipWith, zipWithIndex, zipWithIndex
Methods inherited from interface io.vavr.PartialFunction
lift
Methods inherited from interface io.vavr.collection.SortedMultimap
distinct, distinctBy, distinctBy, drop, dropRight, dropUntil, dropWhile, filter, filter, filterKeys, filterValues, groupBy, grouped, init, initOption, merge, merge, orElse, orElse, partition, peek, put, put, reject, reject, rejectKeys, rejectValues, remove, remove, removeAll, removeAll, removeKeys, removeValues, replace, replace, replaceAll, replaceAll, replaceValue, retainAll, scan, slideBy, sliding, sliding, span, tail, tailOption, take, takeRight, takeUntil, takeWhile
Methods inherited from interface io.vavr.collection.Traversable
arrangeBy, average, containsAll, count, equals, existsUnique, find, findLast, foldLeft, forEachWithIndex, get, hashCode, head, headOption, isEmpty, isOrdered, isSequential, isSingleValued, last, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, nonEmpty, product, reduceLeft, reduceLeftOption, reduceRight, reduceRightOption, single, singleOption, spliterator, sum
Methods inherited from interface io.vavr.Value
collect, collect, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, isAsync, isLazy, out, out, stderr, stdout, stringPrefix, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toString, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
TreeMultimap
private TreeMultimap(Map<K, Traversable<V>> back, Multimap.ContainerType containerType, AbstractMultimap.SerializableSupplier<Traversable<?>> emptyContainer)
-
-
Method Details
-
withSeq
-
withSet
-
withSortedSet
-
withSortedSet
-
narrow
Narrows a widenedHashMultimap<? extends K, ? extends V>
toHashMultimap<K, V>
by performing a type safe-cast. This is eligible because immutable/read-only collections are covariant.- Type Parameters:
K
- Key typeV
- Value type- Parameters:
map
- AMap
.- Returns:
- the given
multimap
instance as narrowed typeMultimap<K, V>
.
-
emptyMapSupplier
- Specified by:
emptyMapSupplier
in classAbstractMultimap<K,
V, TreeMultimap<K, V>>
-
emptyInstance
- Specified by:
emptyInstance
in classAbstractMultimap<K,
V, TreeMultimap<K, V>>
-
createFromMap
- Specified by:
createFromMap
in classAbstractMultimap<K,
V, TreeMultimap<K, V>>
-
comparator
Description copied from interface:Ordered
Returns the comparator which defines the order of the elements contained in this collection.- Specified by:
comparator
in interfaceOrdered<K>
- Returns:
- The comparator that defines the order of this collection's elements.
-
keySet
Description copied from interface:Multimap
Returns the keys contained in this multimap.- Specified by:
keySet
in interfaceMultimap<K,
V> - Specified by:
keySet
in interfaceSortedMultimap<K,
V> - Overrides:
keySet
in classAbstractMultimap<K,
V, TreeMultimap<K, V>> - Returns:
Set
of the keys contained in this multimap.
-
toJavaMap
Description copied from interface:Multimap
Converts this VavrMap
to ajava.util.Map
while preserving characteristics like insertion order (LinkedHashMultimap
) and sort order (SortedMultimap
).- Specified by:
toJavaMap
in interfaceMultimap<K,
V> - Specified by:
toJavaMap
in interfaceSortedMultimap<K,
V> - Overrides:
toJavaMap
in classAbstractMultimap<K,
V, TreeMultimap<K, V>> - Returns:
- a new
java.util.Map
instance
-