MapFunctions

class Object
trait Matchable
class Any
object Scalaz
object map

Value members

Concrete methods

final
def alter[K, A](m: Map[K, A], k: K)(f: Option[A] => Option[A]): Map[K, A]

Vary the value of m get k.

Vary the value of m get k.

final
def getOrAdd[F[_], K, A](m: Map[K, A], k: K)(fa: => F[A])(implicit F: Applicative[F]): F[(Map[K, A], A)]

Grab a value out of Map if it's present. Otherwise evaluate a value to be placed at that key in the Map.

Grab a value out of Map if it's present. Otherwise evaluate a value to be placed at that key in the Map.

final
def insertWith[K, A](m1: Map[K, A], k: K, v: A)(f: (A, A) => A): Map[K, A]

As with Map.updated, but resolve a collision with f. The first argument is guaranteed to be from m1.

As with Map.updated, but resolve a collision with f. The first argument is guaranteed to be from m1.

final
def intersectWith[K, A, B, C](m1: Map[K, A], m2: Map[K, B])(f: (A, B) => C): Map[K, C]

Collect only elements with matching keys, joining their associated values with f.

Collect only elements with matching keys, joining their associated values with f.

final
def intersectWithKey[K, A, B, C](m1: Map[K, A], m2: Map[K, B])(f: (K, A, B) => C): Map[K, C]

Like intersectWith, but tell f about the key.

Like intersectWith, but tell f about the key.

final
def mapKeys[K, K2, A](m: Map[K, A])(f: K => K2): Map[K2, A]

Exchange keys of m according to f. Result may be smaller if f maps two or more Ks to the same K2, in which case the resulting associated value is an arbitrary choice.

Exchange keys of m according to f. Result may be smaller if f maps two or more Ks to the same K2, in which case the resulting associated value is an arbitrary choice.

final
def unionWith[K, A](m1: Map[K, A], m2: Map[K, A])(f: (A, A) => A): Map[K, A]

Union, resolving collisions with f, where the first arg is guaranteed to be from m1, the second from m2.

Union, resolving collisions with f, where the first arg is guaranteed to be from m1, the second from m2.

Note

iff f gives rise to a scalaz.Semigroup, so does unionWith(_, _)(f).

final
def unionWithKey[K, A](m1: Map[K, A], m2: Map[K, A])(f: (K, A, A) => A): Map[K, A]

Like unionWith, but telling f about the key.

Like unionWith, but telling f about the key.