final class NonEmptyMap[K, V] extends AnyRef
A non-empty wrapper for the scala immutable map. Note - this does not attempt to implement all features of map but what the author considers to be the "normal ones".
- Self Type
- NonEmptyMap[K, V]
- Alphabetic
- By Inheritance
- NonEmptyMap
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def +(elem: (K, V)): NonEmptyMap[K, V]
Creates a new
NonEmptyMap
with an additional element, unless the element is already present.Creates a new
NonEmptyMap
with an additional element, unless the element is already present.- elem
the element to be added
- returns
a new map that contains all elements of this map and that also contains
elem
.
- def ++(elems: Iterable[(K, V)]): NonEmptyMap[K, V]
Creates a new
NonEmptyMap
by adding all elements contained in another collection to thisNonEmptyMap
, omitting duplicates.Creates a new
NonEmptyMap
by adding all elements contained in another collection to thisNonEmptyMap
, omitting duplicates.This method takes a collection of elements and adds all elements, omitting duplicates, into
NonEmptyMap
.Example:
scala> val a = NonEmptyMap(1, 2) ++ NonEmptyMap(2, "a") a: zio.prelude.NonEmptyMap[Any] = NonEmptyMap(1, 2, a)
- elems
the collection containing the elements to add.
- returns
a new
NonEmptyMap
with the given elements added, omitting duplicates.
- def add(elem: (K, V)): NonEmptyMap[K, V]
Adds the
elem
to thisNonEmptyMap
.Adds the
elem
to thisNonEmptyMap
. Alias for+
. - def equals(that: Any): Boolean
- Definition Classes
- NonEmptyMap → AnyRef → Any
- def hashCode(): Int
- Definition Classes
- NonEmptyMap → AnyRef → Any
- def keySet: NonEmptySet[K]
- def mapValues[V1](f: (V) => V1): NonEmptyMap[K, V1]
Produces a new non empty map where values mapped according to function f.
Produces a new non empty map where values mapped according to function f. For compatibility does not use map.iew
- def peel: ((K, V), Map[K, V])
Returns an element of this
NonEmptyMap
and the remainder, which is a (possibly empty)Map
.Returns an element of this
NonEmptyMap
and the remainder, which is a (possibly empty)Map
.- Annotations
- @inline()
- def peelNonEmpty: ((K, V), Option[NonEmptyMap[K, V]])
Returns an element of this
NonEmptyMap
and the remainder orNone
, if the remainder is empty. - def remove(elem: K): Map[K, V]
Removes the
elem
from thisNonEmptyMap
.Removes the
elem
from thisNonEmptyMap
. Alias for-
. - def tailNonEmpty: Option[NonEmptyMap[K, V]]
Returns the tail of this
NonEmptyMap
if it exists orNone
otherwise. - def toMap: Map[K, V]
Converts this
NonEmptyMap
to aMap
. - def toString(): String
- Definition Classes
- NonEmptyMap → AnyRef → Any
- def values: NonEmptyChunk[V]