K
- Key typeV
- Value typepublic interface Map<K,V> extends Traversable<Tuple2<K,V>>, Function1<K,V>
Map
interface.λ.Memoized
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
Modifier and Type | Method and Description |
---|---|
default V |
apply(K key)
Applies this function to one argument and returns the result.
|
<K2,V2> Map<K2,V2> |
bimap(Function<? super K,? extends K2> keyMapper,
Function<? super V,? extends V2> valueMapper)
Maps this
Map to a new Map with different component type by applying a function to its elements. |
default boolean |
contains(Tuple2<K,V> element)
Shortcut for
exists(e -> Objects.equals(e, element)) , tests if the given element is contained. |
boolean |
containsKey(K key)
Returns
true if this map contains a mapping for the specified key. |
default boolean |
containsValue(V value)
Returns
true if this map maps one or more keys to the
specified value. |
Map<K,V> |
distinct()
Returns a new version of this which contains no duplicates.
|
Map<K,V> |
distinctBy(Comparator<? super Tuple2<K,V>> comparator)
Returns a new version of this which contains no duplicates.
|
<U> Map<K,V> |
distinctBy(Function<? super Tuple2<K,V>,? extends U> keyExtractor)
Returns a new version of this which contains no duplicates.
|
Map<K,V> |
drop(long n)
Drops the first n elements of this or all elements, if this length < n.
|
Map<K,V> |
dropRight(long n)
Drops the last n elements of this or all elements, if this length < n.
|
Map<K,V> |
dropUntil(Predicate<? super Tuple2<K,V>> predicate)
Drops elements until the predicate holds for the current element.
|
Map<K,V> |
dropWhile(Predicate<? super Tuple2<K,V>> predicate)
Drops elements while the predicate holds for the current element.
|
Map<K,V> |
filter(Predicate<? super Tuple2<K,V>> predicate)
Returns a new traversable consisting of all elements which satisfy the given predicate.
|
<K2,V2> Map<K2,V2> |
flatMap(BiFunction<? super K,? super V,? extends Iterable<Tuple2<K2,V2>>> mapper)
FlatMaps this
Map to a new Map with different component type. |
default <U> Seq<U> |
flatMap(Function<? super Tuple2<K,V>,? extends Iterable<? extends U>> mapper)
Flat-maps this entries to a sequence of values.
|
default <U> U |
foldRight(U zero,
BiFunction<? super Tuple2<K,V>,? super U,? extends U> f)
Accumulates the elements of this Traversable by successively calling the given function
f from the right,
starting with a value zero of type B. |
default void |
forEach(BiConsumer<K,V> action)
Performs an action on key, value pair.
|
Option<V> |
get(K key)
Returns the
Some of value to which the specified key
is mapped, or None if this map contains no mapping for the key. |
<C> Map<C,? extends Map<K,V>> |
groupBy(Function<? super Tuple2<K,V>,? extends C> classifier)
Groups this elements by classifying the elements.
|
Iterator<? extends Map<K,V>> |
grouped(long size)
Groups this
Traversable into fixed size blocks. |
default boolean |
hasDefiniteSize()
Checks if this Traversable is known to have a finite size.
|
default Option<Tuple2<K,V>> |
headOption()
Returns the first element of a non-empty Traversable as
Option . |
Map<K,V> |
init()
Dual of Traversable.tail(), returning all elements except the last.
|
Option<? extends Map<K,V>> |
initOption()
Dual of Traversable.tailOption(), returning all elements except the last as
Option . |
default boolean |
isTraversableAgain()
Checks if this Traversable can be repeatedly traversed.
|
Iterator<Tuple2<K,V>> |
iterator()
An iterator by means of head() and tail().
|
Set<K> |
keySet()
Returns the keys contained in this map.
|
default int |
length()
Computes the number of elements of this Traversable.
|
<K2,V2> Map<K2,V2> |
map(BiFunction<? super K,? super V,Tuple2<K2,V2>> mapper)
Maps the entries of this
Map to form a new Map . |
default <U> Seq<U> |
map(Function<? super Tuple2<K,V>,? extends U> mapper)
Maps the
Map entries to a sequence of values. |
<V2> Map<K,V2> |
mapValues(Function<? super V,? extends V2> valueMapper)
Maps the values of this
Map while preserving the corresponding keys. |
Map<K,V> |
merge(Map<? extends K,? extends V> that)
Creates a new map which by merging the entries of
this map and that map. |
<U extends V> |
merge(Map<? extends K,U> that,
BiFunction<? super V,? super U,? extends V> collisionResolution)
Creates a new map which by merging the entries of
this map and that map. |
static <K,V> Map<K,V> |
narrow(Map<? extends K,? extends V> map)
Narrows a widened
Map<? extends K, ? extends V> to Map<K, V>
by performing a type safe-cast. |
Tuple2<? extends Map<K,V>,? extends Map<K,V>> |
partition(Predicate<? super Tuple2<K,V>> predicate)
Creates a partition of this
Traversable by splitting this elements in two in distinct tarversables
according to a predicate. |
Map<K,V> |
peek(Consumer<? super Tuple2<K,V>> action)
Performs the given
action on the first element if this is an eager implementation. |
Map<K,V> |
put(K key,
V value)
Associates the specified value with the specified key in this map.
|
Map<K,V> |
put(Tuple2<? extends K,? extends V> entry)
Convenience method for
put(entry._1, entry._2) . |
Map<K,V> |
remove(K key)
Removes the mapping for a key from this map if it is present.
|
Map<K,V> |
removeAll(Iterable<? extends K> keys)
Removes the mapping for a key from this map if it is present.
|
Map<K,V> |
replace(Tuple2<K,V> currentElement,
Tuple2<K,V> newElement)
Replaces the first occurrence (if exists) of the given currentElement with newElement.
|
Map<K,V> |
replaceAll(Tuple2<K,V> currentElement,
Tuple2<K,V> newElement)
Replaces all occurrences of the given currentElement with newElement.
|
Map<K,V> |
retainAll(Iterable<? extends Tuple2<K,V>> elements)
Keeps all occurrences of the given elements from this.
|
Map<K,V> |
scan(Tuple2<K,V> zero,
BiFunction<? super Tuple2<K,V>,? super Tuple2<K,V>,? extends Tuple2<K,V>> operation)
Computes a prefix scan of the elements of the collection.
|
default <U> Seq<U> |
scanLeft(U zero,
BiFunction<? super U,? super Tuple2<K,V>,? extends U> operation)
Produces a collection containing cumulative results of applying the
operator going left to right.
|
default <U> Seq<U> |
scanRight(U zero,
BiFunction<? super Tuple2<K,V>,? super U,? extends U> operation)
Produces a collection containing cumulative results of applying the
operator going right to left.
|
int |
size()
Computes the number of elements of this Traversable.
|
Iterator<? extends Map<K,V>> |
sliding(long size)
Slides a window of a specific
size and step size 1 over this Traversable by calling
Traversable.sliding(long, long) . |
Iterator<? extends Map<K,V>> |
sliding(long size,
long step)
Slides a window of a specific
size and step size over this Traversable . |
Tuple2<? extends Map<K,V>,? extends Map<K,V>> |
span(Predicate<? super Tuple2<K,V>> predicate)
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. |
default Spliterator<Tuple2<K,V>> |
spliterator() |
Map<K,V> |
tail()
Drops the first element of a non-empty Traversable.
|
Option<? extends Map<K,V>> |
tailOption()
Drops the first element of a non-empty Traversable and returns an
Option . |
Map<K,V> |
take(long n)
Takes the first n elements of this or all elements, if this length < n.
|
Map<K,V> |
takeRight(long n)
Takes the last n elements of this or all elements, if this length < n.
|
Map<K,V> |
takeUntil(Predicate<? super Tuple2<K,V>> predicate)
Takes elements until the predicate holds for the current element.
|
Map<K,V> |
takeWhile(Predicate<? super Tuple2<K,V>> predicate)
Takes elements while the predicate holds for the current element.
|
Map<K,V> |
toJavaMap()
Converts this Javaslang
Map to a java.util.Map while preserving characteristics
like insertion order (LinkedHashMap ) and sort order (SortedMap ). |
default <U> U |
transform(Function<? super Map<K,V>,? extends U> f)
Transforms this
Map . |
default <U> Seq<U> |
traverse(BiFunction<K,V,? extends U> mapper) |
default <T1,T2> Tuple2<Seq<T1>,Seq<T2>> |
unzip(BiFunction<? super K,? super V,Tuple2<? extends T1,? extends T2>> unzipper) |
default <T1,T2> Tuple2<Seq<T1>,Seq<T2>> |
unzip(Function<? super Tuple2<K,V>,Tuple2<? extends T1,? extends T2>> unzipper)
Unzips this elements by mapping this elements to pairs which are subsequently split into two distinct
sets.
|
default <T1,T2,T3> Tuple3<Seq<T1>,Seq<T2>,Seq<T3>> |
unzip3(BiFunction<? super K,? super V,Tuple3<? extends T1,? extends T2,? extends T3>> unzipper) |
default <T1,T2,T3> Tuple3<Seq<T1>,Seq<T2>,Seq<T3>> |
unzip3(Function<? super Tuple2<K,V>,Tuple3<? extends T1,? extends T2,? extends T3>> unzipper)
Unzips this elements by mapping this elements to triples which are subsequently split into three distinct
sets.
|
Seq<V> |
values() |
default <U> Seq<Tuple2<Tuple2<K,V>,U>> |
zip(Iterable<? extends U> that)
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(Iterable<? extends U> that,
Tuple2<K,V> thisElem,
U thatElem)
Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in
pairs.
|
default Seq<Tuple2<Tuple2<K,V>,Long>> |
zipWithIndex()
Zips this traversable with its indices.
|
average, containsAll, count, existsUnique, find, findLast, foldLeft, get, hash, head, isEmpty, isSingleValued, last, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkString, mkString, mkString, narrow, nonEmpty, product, reduceLeft, reduceLeftOption, reduceRight, reduceRightOption, sum
fold, reduce, reduceOption
corresponds, eq, equals, exists, forAll, forEach, getOption, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, hashCode, narrow, out, out, stderr, stdout, stringPrefix, toArray, toCharSeq, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaOptional, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toList, toMap, toOption, toQueue, toRight, toRight, toSet, toStack, toStream, toString, toTree, toTry, toTry, toVector
andThen, arity, compose, curried, identity, lift, memoized, of, reversed, tupled
isMemoized
static final long serialVersionUID
static <K,V> Map<K,V> narrow(Map<? extends K,? extends V> map)
Map<? extends K, ? extends V>
to Map<K, V>
by performing a type safe-cast. This is eligible because immutable/read-only
collections are covariant.K
- Key typeV
- Value typemap
- A Map
.map
instance as narrowed type Map<K, V>
.default V apply(K key)
Function1
<K2,V2> Map<K2,V2> bimap(Function<? super K,? extends K2> keyMapper, Function<? super V,? extends V2> valueMapper)
Map
to a new Map
with different component type by applying a function to its elements.K2
- key's component type of the map resultV2
- value's component type of the map resultkeyMapper
- a Function
that maps the keys of type K
to keys of type K2
valueMapper
- a Function
that the values of type V
to values of type V2
Map
NullPointerException
- if keyMapper
or valueMapper
is nullboolean containsKey(K key)
true
if this map contains a mapping for the specified key.key
- key whose presence in this map is to be testedtrue
if this map contains a mapping for the specified keydefault boolean containsValue(V value)
true
if this map 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 map is to be testedtrue
if this map maps one or more keys to the
specified value<K2,V2> Map<K2,V2> flatMap(BiFunction<? super K,? super V,? extends Iterable<Tuple2<K2,V2>>> mapper)
Map
to a new Map
with different component type.K2
- key's component type of the mapped Map
V2
- value's component type of the mapped Map
mapper
- A mapperMap
.NullPointerException
- if mapper
is nullOption<V> get(K key)
Some
of value to which the specified key
is mapped, or None
if this map 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 map contains no mapping
for the keySet<K> keySet()
Set
of the keys contained in this map.<K2,V2> Map<K2,V2> map(BiFunction<? super K,? super V,Tuple2<K2,V2>> mapper)
Map
to form a new Map
.K2
- key's component type of the map resultV2
- value's component type of the map resultmapper
- a Function
that maps entries of type (K, V)
to entries of type (K2, V2)
Map
NullPointerException
- if mapper
is null<V2> Map<K,V2> mapValues(Function<? super V,? extends V2> valueMapper)
Map
while preserving the corresponding keys.V2
- the new value typevalueMapper
- a Function
that maps values of type V
to values of type V2
Map
NullPointerException
- if valueMapper
is nullMap<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 keyMap<K,V> put(Tuple2<? extends K,? extends V> entry)
put(entry._1, entry._2)
.entry
- A Map.Tuple2Map<K,V> remove(K key)
key
- key whose mapping is to be removed from the mapMap<K,V> removeAll(Iterable<? extends K> keys)
keys
- keys are to be removed from the mapint size()
Traversable
Same as Traversable.length()
.
size
in interface Traversable<Tuple2<K,V>>
Map<K,V> toJavaMap()
Map
to a java.util.Map
while preserving characteristics
like insertion order (LinkedHashMap
) and sort order (SortedMap
).java.util.Map
instancedefault <U> U transform(Function<? super Map<K,V>,? extends U> f)
Map
.U
- Type of transformation resultf
- A transformationU
NullPointerException
- if f
is nulldefault <U> Seq<U> traverse(BiFunction<K,V,? extends U> mapper)
default <T1,T2> Tuple2<Seq<T1>,Seq<T2>> unzip(BiFunction<? super K,? super V,Tuple2<? extends T1,? extends T2>> unzipper)
default <T1,T2,T3> Tuple3<Seq<T1>,Seq<T2>,Seq<T3>> unzip3(BiFunction<? super K,? super V,Tuple3<? extends T1,? extends T2,? extends T3>> unzipper)
default boolean contains(Tuple2<K,V> element)
Value
exists(e -> Objects.equals(e, element))
, tests if the given element
is contained.Map<K,V> distinct()
Traversable
equals
.distinct
in interface Traversable<Tuple2<K,V>>
Traversable
containing this elements without duplicatesMap<K,V> distinctBy(Comparator<? super Tuple2<K,V>> comparator)
Traversable
comparator
.distinctBy
in interface Traversable<Tuple2<K,V>>
comparator
- A comparatorTraversable
containing this elements without duplicates<U> Map<K,V> distinctBy(Function<? super Tuple2<K,V>,? extends U> keyExtractor)
Traversable
equals
.
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 duplicatesMap<K,V> drop(long n)
Traversable
drop
in interface Traversable<Tuple2<K,V>>
n
- The number of elements to drop.Map<K,V> dropRight(long n)
Traversable
dropRight
in interface Traversable<Tuple2<K,V>>
n
- The number of elements to drop.Map<K,V> dropUntil(Predicate<? super Tuple2<K,V>> predicate)
Traversable
Note: This is essentially the same as dropWhile(predicate.negate())
. It is intended to be used with
method references, which cannot be negated directly.
dropUntil
in interface Traversable<Tuple2<K,V>>
predicate
- A condition tested subsequently for this elements.Map<K,V> dropWhile(Predicate<? super Tuple2<K,V>> predicate)
Traversable
dropWhile
in interface Traversable<Tuple2<K,V>>
predicate
- A condition tested subsequently for this elements starting with the first.Map<K,V> filter(Predicate<? super Tuple2<K,V>> predicate)
Traversable
filter
in interface Traversable<Tuple2<K,V>>
predicate
- A predicatedefault <U> Seq<U> flatMap(Function<? super Tuple2<K,V>,? extends Iterable<? extends U>> mapper)
Please use flatMap(BiFunction)
if the result should be a Map
flatMap
in interface Traversable<Tuple2<K,V>>
U
- Component typemapper
- A mapperdefault <U> U foldRight(U zero, BiFunction<? super Tuple2<K,V>,? super U,? extends U> f)
Traversable
f
from the right,
starting with a value zero
of type B.
Example: List.of("a", "b", "c").foldRight("", (x, xs) -> x + xs) = "abc"
foldRight
in interface Foldable<Tuple2<K,V>>
foldRight
in interface Traversable<Tuple2<K,V>>
U
- Result type of the accumulator.zero
- Value to start the accumulation with.f
- The accumulator function.<C> Map<C,? extends Map<K,V>> groupBy(Function<? super Tuple2<K,V>,? extends C> classifier)
Traversable
groupBy
in interface Traversable<Tuple2<K,V>>
C
- classified class typeclassifier
- A function which classifies elements into classesIterator<? extends Map<K,V>> grouped(long size)
Traversable
Traversable
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(long, long), i.e.
grouped(size)
is the same as sliding(size, size)
.grouped
in interface Traversable<Tuple2<K,V>>
size
- a positive block sizedefault boolean hasDefiniteSize()
Traversable
This method should be implemented by classes only, i.e. not by interfaces.
hasDefiniteSize
in interface Traversable<Tuple2<K,V>>
default Option<Tuple2<K,V>> headOption()
Traversable
Option
.headOption
in interface Traversable<Tuple2<K,V>>
Some(element)
or None
if this is empty.Map<K,V> init()
Traversable
init
in interface Traversable<Tuple2<K,V>>
Option<? extends Map<K,V>> initOption()
Traversable
Option
.initOption
in interface Traversable<Tuple2<K,V>>
Some(traversable)
or None
if this is empty.default boolean isTraversableAgain()
Traversable
This method should be implemented by classes only, i.e. not by interfaces.
isTraversableAgain
in interface Traversable<Tuple2<K,V>>
Iterator<Tuple2<K,V>> iterator()
Traversable
default int length()
Traversable
Same as Traversable.size()
.
length
in interface Traversable<Tuple2<K,V>>
default <U> Seq<U> map(Function<? super Tuple2<K,V>,? extends U> mapper)
Map
entries to a sequence of values.
Please use map(BiFunction)
if the result has to be of type Map
.
Map<K,V> merge(Map<? extends K,? extends V> that)
this
map and that
map.
If collisions occur, the value of this
map is taken.
that
- the other mapNullPointerException
- if that map is null<U extends V> Map<K,V> merge(Map<? extends K,U> that, BiFunction<? super V,? super U,? extends V> collisionResolution)
this
map and that
map.
Uses the specified collision resolution function if two keys are the same.
The collision resolution function will always take the first argument from this
map
and the second from that
map.
U
- value type of that Mapthat
- the other mapcollisionResolution
- the collision resolution functionNullPointerException
- if that map or the given collision resolution function is nullTuple2<? extends Map<K,V>,? extends Map<K,V>> partition(Predicate<? super Tuple2<K,V>> predicate)
Traversable
Traversable
by splitting this elements in two in distinct tarversables
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.Map<K,V> peek(Consumer<? super Tuple2<K,V>> action)
Value
action
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.Map<K,V> replace(Tuple2<K,V> currentElement, Tuple2<K,V> newElement)
Traversable
replace
in interface Traversable<Tuple2<K,V>>
currentElement
- An element to be substituted.newElement
- A replacement for currentElement.Map<K,V> replaceAll(Tuple2<K,V> currentElement, Tuple2<K,V> newElement)
Traversable
replaceAll
in interface Traversable<Tuple2<K,V>>
currentElement
- An element to be substituted.newElement
- A replacement for currentElement.Map<K,V> retainAll(Iterable<? extends Tuple2<K,V>> elements)
Traversable
retainAll
in interface Traversable<Tuple2<K,V>>
elements
- Elements to be kept.Map<K,V> scan(Tuple2<K,V> zero, BiFunction<? super Tuple2<K,V>,? super Tuple2<K,V>,? extends Tuple2<K,V>> operation)
Traversable
scan
in interface Traversable<Tuple2<K,V>>
zero
- neutral element for the operator opoperation
- the associative operator for the scandefault <U> Seq<U> scanLeft(U zero, BiFunction<? super U,? super Tuple2<K,V>,? extends U> operation)
Traversable
scanLeft
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, BiFunction<? super Tuple2<K,V>,? super U,? extends U> operation)
Traversable
scanRight
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 elementIterator<? extends Map<K,V>> sliding(long size)
Traversable
size
and step size 1 over this Traversable
by calling
Traversable.sliding(long, long)
.sliding
in interface Traversable<Tuple2<K,V>>
size
- a positive window sizeIterator<? extends Map<K,V>> sliding(long size, long step)
Traversable
size
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],[4]]
sliding
in interface Traversable<Tuple2<K,V>>
size
- a positive window sizestep
- a positive step sizeTuple2<? extends Map<K,V>,? extends Map<K,V>> span(Predicate<? super Tuple2<K,V>> predicate)
Traversable
predicate
and the second element is the remainder.span
in interface Traversable<Tuple2<K,V>>
predicate
- A predicate.default Spliterator<Tuple2<K,V>> spliterator()
spliterator
in interface Iterable<Tuple2<K,V>>
Map<K,V> tail()
Traversable
tail
in interface Traversable<Tuple2<K,V>>
Option<? extends Map<K,V>> tailOption()
Traversable
Option
.tailOption
in interface Traversable<Tuple2<K,V>>
Some(traversable)
or None
if this is empty.Map<K,V> take(long 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.Map<K,V> takeRight(long 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.Map<K,V> takeUntil(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.Map<K,V> takeWhile(Predicate<? super Tuple2<K,V>> predicate)
Traversable
takeWhile
in interface Traversable<Tuple2<K,V>>
predicate
- A condition tested subsequently for the contained elements.default <T1,T2> Tuple2<Seq<T1>,Seq<T2>> unzip(Function<? super Tuple2<K,V>,Tuple2<? extends T1,? extends T2>> unzipper)
Traversable
unzip
in interface Traversable<Tuple2<K,V>>
T1
- 1st element type of a pair returned by unzipperT2
- 2nd element type of a pair returned by unzipperunzipper
- a function which converts elements of this to pairsdefault <T1,T2,T3> Tuple3<Seq<T1>,Seq<T2>,Seq<T3>> unzip3(Function<? super Tuple2<K,V>,Tuple3<? extends T1,? extends T2,? extends T3>> unzipper)
Traversable
unzip3
in interface Traversable<Tuple2<K,V>>
T1
- 1st element type of a triplet returned by unzipperT2
- 2nd element type of a triplet returned by unzipperT3
- 3rd element type of a triplet returned by unzipperunzipper
- a function which converts elements of this to pairsdefault <U> Seq<Tuple2<Tuple2<K,V>,U>> zip(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(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 Seq<Tuple2<Tuple2<K,V>,Long>> zipWithIndex()
Traversable
zipWithIndex
in interface Traversable<Tuple2<K,V>>
default void forEach(BiConsumer<K,V> action)
action
- A BiConsumer
NullPointerException
- if action
is nullCopyright © 2016. All Rights Reserved.