Package io.vavr.collection
Class LinkedHashMultimap<K,V>
- java.lang.Object
-
- io.vavr.collection.AbstractMultimap<K,V,LinkedHashMultimap<K,V>>
-
- io.vavr.collection.LinkedHashMultimap<K,V>
-
- Type Parameters:
K
- Key typeV
- Value type
- All Implemented Interfaces:
Foldable<Tuple2<K,V>>
,Multimap<K,V>
,Traversable<Tuple2<K,V>>
,Function1<K,Traversable<V>>
,PartialFunction<K,Traversable<V>>
,Value<Tuple2<K,V>>
,java.io.Serializable
,java.lang.Iterable<Tuple2<K,V>>
,java.util.function.Function<K,Traversable<V>>
public final class LinkedHashMultimap<K,V> extends AbstractMultimap<K,V,LinkedHashMultimap<K,V>> implements java.io.Serializable
ALinkedHashMap
-based implementation ofMultimap
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LinkedHashMultimap.Builder<V>
-
Nested 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
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Fields inherited from class io.vavr.collection.AbstractMultimap
back, emptyContainer
-
-
Constructor Summary
Constructors Modifier Constructor Description private
LinkedHashMultimap(Map<K,Traversable<V>> back, Multimap.ContainerType containerType, AbstractMultimap.SerializableSupplier<Traversable<?>> emptyContainer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <K2,V2>
LinkedHashMultimap<K2,V2>createFromMap(Map<K2,Traversable<V2>> back)
protected <K2,V2>
LinkedHashMultimap<K2,V2>emptyInstance()
protected <K2,V2>
Map<K2,V2>emptyMapSupplier()
boolean
isSequential()
Checks if the elements of this Traversable appear in encounter order.static <K,V>
LinkedHashMultimap<K,V>narrow(LinkedHashMultimap<? extends K,? extends V> map)
Narrows a widenedHashMultimap<? extends K, ? extends V>
toHashMultimap<K, V>
by performing a type safe-cast.static <V> LinkedHashMultimap.Builder<V>
withSeq()
static <V> LinkedHashMultimap.Builder<V>
withSet()
static <V extends java.lang.Comparable<?>>
LinkedHashMultimap.Builder<V>withSortedSet()
static <V> LinkedHashMultimap.Builder<V>
withSortedSet(java.util.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, keySet, 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, 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, asPartialFunction, collect, contains, containsValue, flatMap, foldRight, forEach, hasDefiniteSize, isDefinedAt, isDistinct, isTraversableAgain, iterator, length, map, scanLeft, scanRight, transform, unzip, unzip, unzip3, unzip3, zip, zipAll, zipWith, zipWithIndex, zipWithIndex
-
Methods inherited from interface io.vavr.PartialFunction
lift
-
Methods inherited from interface io.vavr.collection.Traversable
arrangeBy, average, containsAll, count, existsUnique, find, findLast, foldLeft, forEachWithIndex, get, headOption, isOrdered, isSingleValued, 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, out, out, stderr, stdout, 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, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LinkedHashMultimap
private LinkedHashMultimap(Map<K,Traversable<V>> back, Multimap.ContainerType containerType, AbstractMultimap.SerializableSupplier<Traversable<?>> emptyContainer)
-
-
Method Detail
-
withSeq
public static <V> LinkedHashMultimap.Builder<V> withSeq()
-
withSet
public static <V> LinkedHashMultimap.Builder<V> withSet()
-
withSortedSet
public static <V extends java.lang.Comparable<?>> LinkedHashMultimap.Builder<V> withSortedSet()
-
withSortedSet
public static <V> LinkedHashMultimap.Builder<V> withSortedSet(java.util.Comparator<? super V> comparator)
-
narrow
public static <K,V> LinkedHashMultimap<K,V> narrow(LinkedHashMultimap<? extends K,? extends V> map)
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
protected <K2,V2> Map<K2,V2> emptyMapSupplier()
- Specified by:
emptyMapSupplier
in classAbstractMultimap<K,V,LinkedHashMultimap<K,V>>
-
emptyInstance
protected <K2,V2> LinkedHashMultimap<K2,V2> emptyInstance()
- Specified by:
emptyInstance
in classAbstractMultimap<K,V,LinkedHashMultimap<K,V>>
-
createFromMap
protected <K2,V2> LinkedHashMultimap<K2,V2> createFromMap(Map<K2,Traversable<V2>> back)
- Specified by:
createFromMap
in classAbstractMultimap<K,V,LinkedHashMultimap<K,V>>
-
isSequential
public boolean isSequential()
Description copied from interface:Traversable
Checks if the elements of this Traversable appear in encounter order.- Specified by:
isSequential
in interfaceTraversable<K>
- Returns:
- true, if the insertion order of elements is preserved, false otherwise.
-
-