K - Key typeV - Value type@Deprecated public interface Multimap<K,V> extends Traversable<Tuple2<K,V>>, PartialFunction<K,Traversable<V>>, java.io.Serializable
Multimap interface.
Basic operations:
containsKey(Object)containsValue(Object)get(Object)getContainerType()keySet()merge(Multimap)merge(Multimap, BiFunction)put(Object, Object)put(Tuple2)values()| Modifier and Type | Interface and Description |
|---|---|
static class |
Multimap.ContainerType
Deprecated.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
serialVersionUID
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
default Traversable<V> |
apply(K key)
Deprecated.
|
Map<K,Traversable<V>> |
asMap()
Deprecated.
Converts this
Multimap to a Map |
default PartialFunction<K,Traversable<V>> |
asPartialFunction()
Deprecated.
Turns this
Multimap into a PartialFunction which is defined at a specific index, if this Multimap
contains the given key. |
<K2,V2> Multimap<K2,V2> |
bimap(java.util.function.Function<? super K,? extends K2> keyMapper,
java.util.function.Function<? super V,? extends V2> valueMapper)
Deprecated.
Maps this
Multimap to a new Multimap with different component type by applying a function to its elements. |
default <R> Seq<R> |
collect(PartialFunction<? super Tuple2<K,V>,? extends R> partialFunction)
Deprecated.
Collects all elements that are in the domain of the given
partialFunction by mapping the elements to type R. |
default boolean |
contains(Tuple2<K,V> element)
Deprecated.
Shortcut for
exists(e -> Objects.equals(e, element)), tests if the given element is contained. |
boolean |
containsKey(K key)
Deprecated.
Returns
true if this multimap contains a mapping for the specified key. |
default boolean |
containsValue(V value)
Deprecated.
Returns
true if this multimap maps one or more keys to the
specified value. |
Multimap<K,V> |
distinct()
Deprecated.
Returns a new version of this which contains no duplicates.
|
Multimap<K,V> |
distinctBy(java.util.Comparator<? super Tuple2<K,V>> comparator)
Deprecated.
Returns a new version of this which contains no duplicates.
|
<U> Multimap<K,V> |
distinctBy(java.util.function.Function<? super Tuple2<K,V>,? extends U> keyExtractor)
Deprecated.
Returns a new version of this which contains no duplicates.
|
Multimap<K,V> |
drop(int n)
Deprecated.
Drops the first n elements of this or all elements, if this length < n.
|
Multimap<K,V> |
dropRight(int n)
Deprecated.
Drops the last n elements of this or all elements, if this length < n.
|
Multimap<K,V> |
dropUntil(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Drops elements until the predicate holds for the current element.
|
Multimap<K,V> |
dropWhile(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Drops elements while the predicate holds for the current element.
|
Multimap<K,V> |
filter(java.util.function.BiPredicate<? super K,? super V> predicate)
Deprecated.
Returns a new Multimap consisting of all elements which satisfy the given predicate.
|
Multimap<K,V> |
filter(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Returns a new traversable consisting of all elements which satisfy the given predicate.
|
Multimap<K,V> |
filterKeys(java.util.function.Predicate<? super K> predicate)
Deprecated.
Returns a new Multimap consisting of all elements with keys which satisfy the given predicate.
|
Multimap<K,V> |
filterNot(java.util.function.BiPredicate<? super K,? super V> predicate)
Deprecated.
Returns a new Multimap consisting of all elements which do not satisfy the given predicate.
|
Multimap<K,V> |
filterNot(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Returns a new traversable consisting of all elements which do not satisfy the given predicate.
|
Multimap<K,V> |
filterNotKeys(java.util.function.Predicate<? super K> predicate)
Deprecated.
Returns a new Multimap consisting of all elements with keys which do not satisfy the given predicate.
|
Multimap<K,V> |
filterNotValues(java.util.function.Predicate<? super V> predicate)
Deprecated.
Returns a new Multimap consisting of all elements with values which do not satisfy the given predicate.
|
Multimap<K,V> |
filterValues(java.util.function.Predicate<? super V> predicate)
Deprecated.
Returns a new Multimap consisting of all elements with values which satisfy the given predicate.
|
<K2,V2> Multimap<K2,V2> |
flatMap(java.util.function.BiFunction<? super K,? super V,? extends java.lang.Iterable<Tuple2<K2,V2>>> mapper)
Deprecated.
FlatMaps this
Multimap to a new Multimap with different component type. |
default <U> Seq<U> |
flatMap(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<? extends U>> mapper)
Deprecated.
Flat-maps this entries to a sequence of values.
|
default <U> U |
foldRight(U zero,
java.util.function.BiFunction<? super Tuple2<K,V>,? super U,? extends U> f)
Deprecated.
Folds this elements from the right, starting with
zero and successively calling combine. |
default void |
forEach(java.util.function.BiConsumer<K,V> action)
Deprecated.
Performs an action on key, value pair.
|
Option<Traversable<V>> |
get(K key)
Deprecated.
Returns the
Some of value to which the specified key
is mapped, or None if this multimap contains no mapping for the key. |
Multimap.ContainerType |
getContainerType()
Deprecated.
Returns the type of the
Traversable value container of this MultiMap. |
Traversable<V> |
getOrElse(K key,
Traversable<? extends V> defaultValue)
Deprecated.
Returns the value associated with a key, or a default value if the key is not contained in the map
|
<C> Map<C,? extends Multimap<K,V>> |
groupBy(java.util.function.Function<? super Tuple2<K,V>,? extends C> classifier)
Deprecated.
Groups this elements by classifying the elements.
|
Iterator<? extends Multimap<K,V>> |
grouped(int size)
Deprecated.
Groups this
Traversable into fixed size blocks. |
default boolean |
hasDefiniteSize()
Deprecated.
Checks if this Traversable is known to have a finite size.
|
Multimap<K,V> |
init()
Deprecated.
Dual of Traversable.tail(), returning all elements except the last.
|
Option<? extends Multimap<K,V>> |
initOption()
Deprecated.
Dual of Traversable.tailOption(), returning all elements except the last as
Option. |
default boolean |
isDefinedAt(K key)
Deprecated.
|
default boolean |
isDistinct()
Deprecated.
Checks if this Traversable may consist of distinct elements only.
|
default boolean |
isTraversableAgain()
Deprecated.
Checks if this Traversable can be repeatedly traversed.
|
Iterator<Tuple2<K,V>> |
iterator()
Deprecated.
An iterator by means of head() and tail().
|
default <U> Iterator<U> |
iterator(java.util.function.BiFunction<K,V,? extends U> mapper)
Deprecated.
Iterates this Multimap sequentially, mapping the (key, value) pairs to elements.
|
Set<K> |
keySet()
Deprecated.
Returns the keys contained in this multimap.
|
default int |
length()
Deprecated.
Computes the number of elements of this Traversable.
|
<K2,V2> Multimap<K2,V2> |
map(java.util.function.BiFunction<? super K,? super V,Tuple2<K2,V2>> mapper)
Deprecated.
Maps the entries of this
Multimap to form a new Multimap. |
default <U> Seq<U> |
map(java.util.function.Function<? super Tuple2<K,V>,? extends U> mapper)
Deprecated.
Maps the
Multimap entries to a sequence of values. |
<V2> Multimap<K,V2> |
mapValues(java.util.function.Function<? super V,? extends V2> valueMapper)
Deprecated.
Maps the values of this
Multimap while preserving the corresponding keys. |
Multimap<K,V> |
merge(Multimap<? extends K,? extends V> that)
Deprecated.
Creates a new multimap which by merging the entries of
this multimap and that multimap. |
<K2 extends K,V2 extends V> |
merge(Multimap<K2,V2> that,
java.util.function.BiFunction<Traversable<V>,Traversable<V2>,Traversable<V>> collisionResolution)
Deprecated.
Creates a new multimap which by merging the entries of
this multimap and that multimap. |
static <K,V> Multimap<K,V> |
narrow(Multimap<? extends K,? extends V> map)
Deprecated.
Narrows a widened
Multimap<? extends K, ? extends V> to Multimap<K, V>
by performing a type-safe cast. |
Multimap<K,V> |
orElse(java.lang.Iterable<? extends Tuple2<K,V>> other)
Deprecated.
Returns this
Traversable if it is nonempty, otherwise return the alternative. |
Multimap<K,V> |
orElse(java.util.function.Supplier<? extends java.lang.Iterable<? extends Tuple2<K,V>>> supplier)
Deprecated.
Returns this
Traversable if it is nonempty, otherwise return the result of evaluating supplier. |
Tuple2<? extends Multimap<K,V>,? extends Multimap<K,V>> |
partition(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Creates a partition of this
Traversable by splitting this elements in two in distinct traversables
according to a predicate. |
Multimap<K,V> |
peek(java.util.function.Consumer<? super Tuple2<K,V>> action)
Deprecated.
Performs the given
action on the first element if this is an eager implementation. |
Multimap<K,V> |
put(K key,
V value)
Deprecated.
Associates the specified value with the specified key in this multimap.
|
Multimap<K,V> |
put(Tuple2<? extends K,? extends V> entry)
Deprecated.
Convenience method for
put(entry._1, entry._2). |
Multimap<K,V> |
remove(K key)
Deprecated.
Removes the mapping for a key from this multimap if it is present.
|
Multimap<K,V> |
remove(K key,
V value)
Deprecated.
Removes the key-value pair from this multimap if it is present.
|
Multimap<K,V> |
removeAll(java.lang.Iterable<? extends K> keys)
Deprecated.
Removes the mapping for a key from this multimap if it is present.
|
Multimap<K,V> |
replace(K key,
V oldValue,
V newValue)
Deprecated.
Replaces the entry with the specified key and oldValue.
|
Multimap<K,V> |
replace(Tuple2<K,V> currentElement,
Tuple2<K,V> newElement)
Deprecated.
Replaces the first occurrence (if exists) of the given currentElement with newElement.
|
Multimap<K,V> |
replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
Deprecated.
Replaces each entry's values with the result of invoking the given function on that each tuple until all entries have been processed or the function throws an exception.
|
Multimap<K,V> |
replaceAll(Tuple2<K,V> currentElement,
Tuple2<K,V> newElement)
Deprecated.
Replaces all occurrences of the given currentElement with newElement.
|
Multimap<K,V> |
replaceValue(K key,
V value)
Deprecated.
Replaces the entry for the specified key only if it is currently mapped to some value.
|
Multimap<K,V> |
retainAll(java.lang.Iterable<? extends Tuple2<K,V>> elements)
Deprecated.
Keeps all occurrences of the given elements from this.
|
Multimap<K,V> |
scan(Tuple2<K,V> zero,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K,V>,? extends Tuple2<K,V>> operation)
Deprecated.
Computes a prefix scan of the elements of the collection.
|
default <U> Seq<U> |
scanLeft(U zero,
java.util.function.BiFunction<? super U,? super Tuple2<K,V>,? extends U> operation)
Deprecated.
Produces a collection containing cumulative results of applying the
operator going left to right.
|
default <U> Seq<U> |
scanRight(U zero,
java.util.function.BiFunction<? super Tuple2<K,V>,? super U,? extends U> operation)
Deprecated.
Produces a collection containing cumulative results of applying the
operator going right to left.
|
int |
size()
Deprecated.
Computes the number of elements of this Traversable.
|
Iterator<? extends Multimap<K,V>> |
slideBy(java.util.function.Function<? super Tuple2<K,V>,?> classifier)
Deprecated.
Slides a non-overlapping window of a variable size over this
Traversable. |
Iterator<? extends Multimap<K,V>> |
sliding(int size)
Deprecated.
Slides a window of a specific
size and step size 1 over this Traversable by calling
Traversable.sliding(int, int). |
Iterator<? extends Multimap<K,V>> |
sliding(int size,
int step)
Deprecated.
Slides a window of a specific
size and step size over this Traversable. |
Tuple2<? extends Multimap<K,V>,? extends Multimap<K,V>> |
span(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Returns a tuple where the first element is the longest prefix of elements that satisfy the given
predicate and the second element is the remainder. |
Multimap<K,V> |
tail()
Deprecated.
Drops the first element of a non-empty Traversable.
|
Option<? extends Multimap<K,V>> |
tailOption()
Deprecated.
Drops the first element of a non-empty Traversable and returns an
Option. |
Multimap<K,V> |
take(int n)
Deprecated.
Takes the first n elements of this or all elements, if this length < n.
|
Multimap<K,V> |
takeRight(int n)
Deprecated.
Takes the last n elements of this or all elements, if this length < n.
|
Multimap<K,V> |
takeUntil(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Takes elements until the predicate holds for the current element.
|
Multimap<K,V> |
takeWhile(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Deprecated.
Takes elements while the predicate holds for the current element.
|
java.util.Map<K,java.util.Collection<V>> |
toJavaMap()
Deprecated.
Converts this Vavr
Map to a java.util.Map while preserving characteristics
like insertion order (LinkedHashMultimap) and sort order (SortedMultimap). |
default <U> U |
transform(java.util.function.Function<? super Multimap<K,V>,? extends U> f)
Deprecated.
Transforms this
Multimap. |
Traversable<V> |
values()
Deprecated.
|
default <U> Seq<Tuple2<Tuple2<K,V>,U>> |
zip(java.lang.Iterable<? extends U> that)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by combining
corresponding elements in pairs.
|
default <U> Seq<Tuple2<Tuple2<K,V>,U>> |
zipAll(java.lang.Iterable<? extends U> that,
Tuple2<K,V> thisElem,
U thatElem)
Deprecated.
Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in
pairs.
|
default <U,R> Seq<R> |
zipWith(java.lang.Iterable<? extends U> that,
java.util.function.BiFunction<? super Tuple2<K,V>,? super U,? extends R> mapper)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by mapping elements.
|
default Seq<Tuple2<Tuple2<K,V>,java.lang.Integer>> |
zipWithIndex()
Deprecated.
Zips this traversable with its indices.
|
default <U> Seq<U> |
zipWithIndex(java.util.function.BiFunction<? super Tuple2<K,V>,? super java.lang.Integer,? extends U> mapper)
Deprecated.
Zips this traversable with its indices by applying mapper provided.
|
arrangeBy, average, containsAll, count, equals, existsUnique, find, findLast, fold, foldLeft, forEachWithIndex, get, hashCode, head, headOption, isEmpty, isOrdered, isSequential, isSingleValued, last, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, narrow, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, single, singleOption, spliterator, sum, toLinkedMap, toMap, toSortedMap, toSortedMap, unzip, unzip3collect, collect, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, isAsync, isLazy, narrow, 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, toVectorliftstatic final long serialVersionUID
static <K,V> Multimap<K,V> narrow(Multimap<? extends K,? extends V> map)
Multimap<? extends K, ? extends V> to Multimap<K, V>
by performing a type-safe cast. This is eligible because immutable/read-only
collections are covariant.K - Key typeV - Value typemap - A Multimap.multimap instance as narrowed type Multimap<K, V>.@Deprecated default Traversable<V> apply(K key)
PartialFunctionapply in interface java.util.function.Function<K,Traversable<V>>apply in interface Function1<K,Traversable<V>>apply in interface PartialFunction<K,Traversable<V>>key - the argumentMap<K,Traversable<V>> asMap()
Multimap to a MapMap<K, Traversable<V>>default PartialFunction<K,Traversable<V>> asPartialFunction() throws java.lang.IndexOutOfBoundsException
Multimap into a PartialFunction which is defined at a specific index, if this Multimap
contains the given key. When applied to a defined key, the partial function will return
the Traversable of this Multimap that is associated with the key.PartialFunctionjava.util.NoSuchElementException - when a non-existing key is applied to the partial functionjava.lang.IndexOutOfBoundsException<K2,V2> Multimap<K2,V2> bimap(java.util.function.Function<? super K,? extends K2> keyMapper, java.util.function.Function<? super V,? extends V2> valueMapper)
Multimap to a new Multimap with different component type by applying a function to its elements.K2 - key's component type of the multimap resultV2 - value's component type of the multimap resultkeyMapper - a Function that maps the keys of type K to keys of type K2valueMapper - a Function that the values of type V to values of type V2Multimapjava.lang.NullPointerException - if keyMapper or valueMapper is nulldefault <R> Seq<R> collect(PartialFunction<? super Tuple2<K,V>,? extends R> partialFunction)
TraversablepartialFunction by mapping the elements to type R.
More specifically, for each of this elements in iteration order first it is checked
partialFunction.isDefinedAt(element)
If the elements makes it through that filter, the mapped instance is added to the result collection
R newElement = partialFunction.apply(element)
Note:If this Traversable is ordered (i.e. extends Ordered,
the caller of collect has to ensure that the elements are comparable (i.e. extend Comparable).collect in interface Traversable<Tuple2<K,V>>R - The new element typepartialFunction - A function that is not necessarily defined of all elements of this traversable.Traversable instance containing elements of type Rdefault boolean contains(Tuple2<K,V> element)
Valueexists(e -> Objects.equals(e, element)), tests if the given element is contained.boolean containsKey(K key)
true if this multimap contains a mapping for the specified key.key - key whose presence in this multimap is to be testedtrue if this multimap contains a mapping for the specified keydefault boolean containsValue(V value)
true if this multimap maps one or more keys to the
specified value. This operation will require time linear in the map size.value - value whose presence in this multimap is to be testedtrue if this multimap maps one or more keys to the
specified valueMultimap<K,V> filter(java.util.function.BiPredicate<? super K,? super V> predicate)
predicate - the predicate used to test elementsjava.lang.NullPointerException - if predicate is nullMultimap<K,V> filterNot(java.util.function.BiPredicate<? super K,? super V> predicate)
predicate - the predicate used to test elementsjava.lang.NullPointerException - if predicate is nullMultimap<K,V> filterKeys(java.util.function.Predicate<? super K> predicate)
predicate - the predicate used to test keys of elementsjava.lang.NullPointerException - if predicate is nullMultimap<K,V> filterNotKeys(java.util.function.Predicate<? super K> predicate)
predicate - the predicate used to test keys of elementsjava.lang.NullPointerException - if predicate is nullMultimap<K,V> filterValues(java.util.function.Predicate<? super V> predicate)
predicate - the predicate used to test values of elementsjava.lang.NullPointerException - if predicate is nullMultimap<K,V> filterNotValues(java.util.function.Predicate<? super V> predicate)
predicate - the predicate used to test values of elementsjava.lang.NullPointerException - if predicate is null<K2,V2> Multimap<K2,V2> flatMap(java.util.function.BiFunction<? super K,? super V,? extends java.lang.Iterable<Tuple2<K2,V2>>> mapper)
Multimap to a new Multimap with different component type.K2 - key's component type of the mapped MultimapV2 - value's component type of the mapped Multimapmapper - A mapperMultimap.java.lang.NullPointerException - if mapper is nulldefault void forEach(java.util.function.BiConsumer<K,V> action)
action - A BiConsumerjava.lang.NullPointerException - if action is nullOption<Traversable<V>> get(K key)
Some of value to which the specified key
is mapped, or None if this multimap contains no mapping for the key.key - the key whose associated value is to be returnedSome of value to which the specified key
is mapped, or None if this multimap contains no mapping
for the keyTraversable<V> getOrElse(K key, Traversable<? extends V> defaultValue)
key - the keydefaultValue - a default valueMultimap.ContainerType getContainerType()
Traversable value container of this MultiMap.default boolean hasDefiniteSize()
TraversableThis method should be implemented by classes only, i.e. not by interfaces.
hasDefiniteSize in interface Traversable<Tuple2<K,V>>@Deprecated default boolean isDefinedAt(K key)
PartialFunctionisDefinedAt in interface PartialFunction<K,Traversable<V>>key - a potential function argumentdefault boolean isDistinct()
TraversableisDistinct in interface Traversable<Tuple2<K,V>>default boolean isTraversableAgain()
TraversableThis method should be implemented by classes only, i.e. not by interfaces.
isTraversableAgain in interface Traversable<Tuple2<K,V>>Iterator<Tuple2<K,V>> iterator()
Traversabledefault <U> Iterator<U> iterator(java.util.function.BiFunction<K,V,? extends U> mapper)
U - The type of the resulting elementsmapper - A function that maps (key, value) pairs to elements of type USet<K> keySet()
Set of the keys contained in this multimap.default int length()
Traversable
Same as Traversable.size().
length in interface Traversable<Tuple2<K,V>><K2,V2> Multimap<K2,V2> map(java.util.function.BiFunction<? super K,? super V,Tuple2<K2,V2>> mapper)
Multimap to form a new Multimap.K2 - key's component type of the multimap resultV2 - value's component type of the multimap resultmapper - a Function that maps entries of type (K, V) to entries of type (K2, V2)Multimapjava.lang.NullPointerException - if mapper is nulldefault <U> Seq<U> map(java.util.function.Function<? super Tuple2<K,V>,? extends U> mapper)
Multimap entries to a sequence of values.
Please use map(BiFunction) if the result has to be of type Multimap.
<V2> Multimap<K,V2> mapValues(java.util.function.Function<? super V,? extends V2> valueMapper)
Multimap while preserving the corresponding keys.V2 - the new value typevalueMapper - a Function that maps values of type V to values of type V2Multimapjava.lang.NullPointerException - if valueMapper is nullMultimap<K,V> merge(Multimap<? extends K,? extends V> that)
this multimap and that multimap.
If collisions occur, the value of this multimap is taken.
that - the other multimapjava.lang.NullPointerException - if that multimap is null<K2 extends K,V2 extends V> Multimap<K,V> merge(Multimap<K2,V2> that, java.util.function.BiFunction<Traversable<V>,Traversable<V2>,Traversable<V>> collisionResolution)
this multimap and that multimap.
Uses the specified collision resolution function if two keys are the same.
The collision resolution function will always take the first argument from this multimap
and the second from that multimap.
K2 - key type of that MultimapV2 - value type of that Multimapthat - the other multimapcollisionResolution - the collision resolution functionjava.lang.NullPointerException - if that multimap or the given collision resolution function is nullMultimap<K,V> put(K key, V value)
key - key with which the specified value is to be associatedvalue - value to be associated with the specified keyMultimap<K,V> put(Tuple2<? extends K,? extends V> entry)
put(entry._1, entry._2).entry - A Tuple2 containing the key and valueMultimap<K,V> remove(K key)
key - key whose mapping is to be removed from the multimapMultimap<K,V> remove(K key, V value)
key - key whose mapping is to be removed from the multimapvalue - value whose mapping is to be removed from the multimapMultimap<K,V> removeAll(java.lang.Iterable<? extends K> keys)
keys - keys are to be removed from the multimapdefault <U> Seq<U> scanLeft(U zero, java.util.function.BiFunction<? super U,? super Tuple2<K,V>,? extends U> operation)
TraversablescanLeft in interface Traversable<Tuple2<K,V>>U - the type of the elements in the resulting collectionzero - the initial valueoperation - the binary operator applied to the intermediate result and the elementdefault <U> Seq<U> scanRight(U zero, java.util.function.BiFunction<? super Tuple2<K,V>,? super U,? extends U> operation)
TraversablescanRight in interface Traversable<Tuple2<K,V>>U - the type of the elements in the resulting collectionzero - the initial valueoperation - the binary operator applied to the intermediate result and the elementint size()
Traversable
Same as Traversable.length().
size in interface Traversable<Tuple2<K,V>>java.util.Map<K,java.util.Collection<V>> toJavaMap()
Map to a java.util.Map while preserving characteristics
like insertion order (LinkedHashMultimap) and sort order (SortedMultimap).java.util.Map instancedefault <U> U transform(java.util.function.Function<? super Multimap<K,V>,? extends U> f)
Multimap.U - Type of transformation resultf - A transformationUjava.lang.NullPointerException - if f is nullTraversable<V> values()
default <U> Seq<Tuple2<Tuple2<K,V>,U>> zip(java.lang.Iterable<? extends U> that)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zip in interface Traversable<Tuple2<K,V>>U - The type of the second half of the returned pairs.that - The Iterable providing the second half of each result pair.that iterable.default <U> Seq<Tuple2<Tuple2<K,V>,U>> zipAll(java.lang.Iterable<? extends U> that, Tuple2<K,V> thisElem, U thatElem)
Traversable
The length of the returned traversable is the maximum of the lengths of this traversable and that
iterable.
Special case: if this traversable is shorter than that elements, and that elements contains duplicates, the resulting traversable may be shorter than the maximum of the lengths of this and that because a traversable contains an element at most once.
If this Traversable is shorter than that, thisElem values are used to fill the result. If that is shorter than this Traversable, thatElem values are used to fill the result.
zipAll in interface Traversable<Tuple2<K,V>>U - The type of the second half of the returned pairs.that - The Iterable providing the second half of each result pair.thisElem - The element to be used to fill up the result if this traversable is shorter than that.thatElem - The element to be used to fill up the result if that is shorter than this traversable.default <U,R> Seq<R> zipWith(java.lang.Iterable<? extends U> that, java.util.function.BiFunction<? super Tuple2<K,V>,? super U,? extends R> mapper)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zipWith in interface Traversable<Tuple2<K,V>>U - The type of the second parameter of the mapper.R - The type of the mapped elements.that - The Iterable providing the second parameter of the mapper.mapper - a mapper.that iterable.default Seq<Tuple2<Tuple2<K,V>,java.lang.Integer>> zipWithIndex()
TraversablezipWithIndex in interface Traversable<Tuple2<K,V>>default <U> Seq<U> zipWithIndex(java.util.function.BiFunction<? super Tuple2<K,V>,? super java.lang.Integer,? extends U> mapper)
TraversablezipWithIndex in interface Traversable<Tuple2<K,V>>U - The type of the mapped elements.mapper - a mapper.Multimap<K,V> distinct()
Traversableequals.distinct in interface Traversable<Tuple2<K,V>>Traversable containing this elements without duplicatesMultimap<K,V> distinctBy(java.util.Comparator<? super Tuple2<K,V>> comparator)
Traversablecomparator.distinctBy in interface Traversable<Tuple2<K,V>>comparator - A comparatorTraversable containing this elements without duplicates<U> Multimap<K,V> distinctBy(java.util.function.Function<? super Tuple2<K,V>,? extends U> keyExtractor)
Traversableequals.
The elements of the result are determined in the order of their occurrence - first match wins.
distinctBy in interface Traversable<Tuple2<K,V>>U - key typekeyExtractor - A key extractorTraversable containing this elements without duplicatesMultimap<K,V> drop(int n)
Traversabledrop in interface Traversable<Tuple2<K,V>>n - The number of elements to drop.Multimap<K,V> dropRight(int n)
TraversabledropRight in interface Traversable<Tuple2<K,V>>n - The number of elements to drop.Multimap<K,V> dropUntil(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
TraversabledropUntil in interface Traversable<Tuple2<K,V>>predicate - A condition tested subsequently for this elements.Multimap<K,V> dropWhile(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Traversable
Note: This is essentially the same as dropUntil(predicate.negate()).
It is intended to be used with method references, which cannot be negated directly.
dropWhile in interface Traversable<Tuple2<K,V>>predicate - A condition tested subsequently for this elements.Multimap<K,V> filter(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Traversablefilter in interface Traversable<Tuple2<K,V>>predicate - A predicateMultimap<K,V> filterNot(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
TraversableThe default implementation is equivalent to
filter(predicate.negate()filterNot in interface Traversable<Tuple2<K,V>>predicate - A predicatedefault <U> Seq<U> flatMap(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<? extends U>> mapper)
Please use flatMap(BiFunction) if the result should be a Multimap
flatMap in interface Traversable<Tuple2<K,V>>U - Component typemapper - A mapperdefault <U> U foldRight(U zero,
java.util.function.BiFunction<? super Tuple2<K,V>,? super U,? extends U> f)
Traversablezero and successively calling combine.
Example:
// = "!cba"
List("a", "b", "c").foldRight("!", (x, xs) -> xs + x)
<C> Map<C,? extends Multimap<K,V>> groupBy(java.util.function.Function<? super Tuple2<K,V>,? extends C> classifier)
TraversablegroupBy in interface Traversable<Tuple2<K,V>>C - classified class typeclassifier - A function which classifies elements into classesTraversable.arrangeBy(Function)Iterator<? extends Multimap<K,V>> grouped(int size)
TraversableTraversable into fixed size blocks.
Let length be the length of this Iterable. Then grouped is defined as follows:
this.isEmpty(), the resulting Iterator is empty.size <= length, the resulting Iterator will contain length / size blocks of size
size and maybe a non-empty block of size length % size, if there are remaining elements.size > length, the resulting Iterator will contain one block of size length.
[].grouped(1) = []
[].grouped(0) throws
[].grouped(-1) throws
[1,2,3,4].grouped(2) = [[1,2],[3,4]]
[1,2,3,4,5].grouped(2) = [[1,2],[3,4],[5]]
[1,2,3,4].grouped(5) = [[1,2,3,4]]
Please note that grouped(int) is a special case of Traversable.sliding(int, int), i.e.
grouped(size) is the same as sliding(size, size).grouped in interface Traversable<Tuple2<K,V>>size - a positive block sizeMultimap<K,V> init()
Traversableinit in interface Traversable<Tuple2<K,V>>Option<? extends Multimap<K,V>> initOption()
TraversableOption.initOption in interface Traversable<Tuple2<K,V>>Some(traversable) or None if this is empty.Multimap<K,V> orElse(java.lang.Iterable<? extends Tuple2<K,V>> other)
TraversableTraversable if it is nonempty, otherwise return the alternative.orElse in interface Traversable<Tuple2<K,V>>other - An alternative TraversableTraversable if it is nonempty, otherwise return the alternative.Multimap<K,V> orElse(java.util.function.Supplier<? extends java.lang.Iterable<? extends Tuple2<K,V>>> supplier)
TraversableTraversable if it is nonempty, otherwise return the result of evaluating supplier.orElse in interface Traversable<Tuple2<K,V>>supplier - An alternative Traversable supplierTraversable if it is nonempty, otherwise return the result of evaluating supplier.Tuple2<? extends Multimap<K,V>,? extends Multimap<K,V>> partition(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
TraversableTraversable by splitting this elements in two in distinct traversables
according to a predicate.partition in interface Traversable<Tuple2<K,V>>predicate - A predicate which classifies an element if it is in the first or the second traversable.Traversable contains all elements that satisfy the given predicate, the second Traversable contains all elements that don't. The original order of elements is preserved.Multimap<K,V> peek(java.util.function.Consumer<? super Tuple2<K,V>> action)
Valueaction on the first element if this is an eager implementation.
Performs the given action on all elements (the first immediately, successive deferred),
if this is a lazy implementation.Multimap<K,V> replace(Tuple2<K,V> currentElement, Tuple2<K,V> newElement)
Traversablereplace in interface Traversable<Tuple2<K,V>>currentElement - An element to be substituted.newElement - A replacement for currentElement.Multimap<K,V> replaceAll(Tuple2<K,V> currentElement, Tuple2<K,V> newElement)
TraversablereplaceAll in interface Traversable<Tuple2<K,V>>currentElement - An element to be substituted.newElement - A replacement for currentElement.Multimap<K,V> replaceValue(K key, V value)
key - the key of the element to be substitutedvalue - the new value to be associated with the keyMultimap<K,V> replace(K key, V oldValue, V newValue)
key - the key of the element to be substitutedoldValue - the expected current value associated with the keynewValue - the new value to be associated with the keyMultimap<K,V> replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
function - function transforming key and current value to a new valueMultimap<K,V> retainAll(java.lang.Iterable<? extends Tuple2<K,V>> elements)
TraversableretainAll in interface Traversable<Tuple2<K,V>>elements - Elements to be kept.Multimap<K,V> scan(Tuple2<K,V> zero, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K,V>,? extends Tuple2<K,V>> operation)
Traversablescan in interface Traversable<Tuple2<K,V>>zero - neutral element for the operator opoperation - the associative operator for the scanIterator<? extends Multimap<K,V>> slideBy(java.util.function.Function<? super Tuple2<K,V>,?> classifier)
TraversableTraversable.
Each window contains elements with the same class, as determined by classifier. Two consecutive
values in this Traversable will be in the same window only if classifier returns equal
values for them. Otherwise, the values will constitute the last element of the previous window and the
first element of the next window.
Examples:
[].slideBy(Function.identity()) = []
[1,2,3,4,4,5].slideBy(Function.identity()) = [[1],[2],[3],[4,4],[5]]
[1,2,3,10,12,5,7,20,29].slideBy(x -> x/10) = [[1,2,3],[10,12],[5,7],[20,29]]
slideBy in interface Traversable<Tuple2<K,V>>classifier - A function which classifies elements into classesIterator<? extends Multimap<K,V>> sliding(int size)
Traversablesize and step size 1 over this Traversable by calling
Traversable.sliding(int, int).sliding in interface Traversable<Tuple2<K,V>>size - a positive window sizeIterator<? extends Multimap<K,V>> sliding(int size, int step)
Traversablesize and step size over this Traversable.
Examples:
[].sliding(1,1) = []
[1,2,3,4,5].sliding(2,3) = [[1,2],[4,5]]
[1,2,3,4,5].sliding(2,4) = [[1,2],[5]]
[1,2,3,4,5].sliding(2,5) = [[1,2]]
[1,2,3,4].sliding(5,3) = [[1,2,3,4]]
sliding in interface Traversable<Tuple2<K,V>>size - a positive window sizestep - a positive step sizeTuple2<? extends Multimap<K,V>,? extends Multimap<K,V>> span(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Traversablepredicate and the second element is the remainder.span in interface Traversable<Tuple2<K,V>>predicate - A predicate.Tuple containing the longest prefix of elements that satisfy p and the remainder.Multimap<K,V> tail()
Traversabletail in interface Traversable<Tuple2<K,V>>Option<? extends Multimap<K,V>> tailOption()
TraversableOption.tailOption in interface Traversable<Tuple2<K,V>>Some(traversable) or None if this is empty.Multimap<K,V> take(int n)
Traversable
The result is equivalent to sublist(0, max(0, min(length(), n))) but does not throw if n < 0 or
n > length().
In the case of n < 0 the empty instance is returned, in the case of n > length() this is returned.
take in interface Traversable<Tuple2<K,V>>n - The number of elements to take.Multimap<K,V> takeRight(int n)
Traversable
The result is equivalent to sublist(max(0, min(length(), length() - n)), n), i.e. takeRight will not
throw if n < 0 or n > length().
In the case of n < 0 the empty instance is returned, in the case of n > length() this is returned.
takeRight in interface Traversable<Tuple2<K,V>>n - The number of elements to take.Multimap<K,V> takeUntil(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Traversable
Note: This is essentially the same as takeWhile(predicate.negate()). It is intended to be used with
method references, which cannot be negated directly.
takeUntil in interface Traversable<Tuple2<K,V>>predicate - A condition tested subsequently for this elements.Multimap<K,V> takeWhile(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
TraversabletakeWhile in interface Traversable<Tuple2<K,V>>predicate - A condition tested subsequently for the contained elements.