final class NonEmptyMap[K, +V] extends AnyVal
A non-empty map: an ordered, immutable, non-empty collection of key-value tuples with LinearSeq performance characteristics.
The purpose of NonEmptyMap is to allow you to express in a type that a Map is non-empty, thereby eliminating the
need for (and potential exception from) a run-time check for non-emptiness. For a non-empty sequence with IndexedSeq
performance, see Every.
 Constructing NonEmptyMaps 
You can construct a NonEmptyMap by passing one or more elements to the NonEmptyMap.apply factory method:
scala> NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") res0: org.scalactic.anyvals.NonEmptyMap[Int, String] = NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three")
 Working with NonEmptyMaps 
NonEmptyMap does not extend Scala's Map or Traversable traits because these require that
implementations may be empty. For example, if you invoke tail on a Seq that contains just one element,
you'll get an empty Seq:
scala> Map(1 -> "one").tail res6: Map[Int] = Map()
On the other hand, many useful methods exist on Map that when invoked on a non-empty Seq are guaranteed
to not result in an empty Map. For convenience, NonEmptyMap defines a method corresponding to every such Map
method. Here are an example:
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three").map(t => (t._1 + 1, t._2)) // Result: NonEmptyMap(2 -> "one", 3 -> "two", 4 -> "three")
NonEmptyMap does not currently define any methods corresponding to Map methods that could result in
an empty Map. However, an implicit converison from NonEmptyMap to Map
is defined in the NonEmptyMap companion object that will be applied if you attempt to call one of the missing methods. As a
result, you can invoke filter on an NonEmptyMap, even though filter could result
in an empty map—but the result type will be Map instead of NonEmptyMap:
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three").filter(_._1 < 10) // Result: Map(1 -> "one", 2 -> "two", 3 -> "three") NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three").filter(_._ 1> 10) // Result: Map()
You can use NonEmptyMaps in for expressions. The result will be an NonEmptyMap unless
you use a filter (an if clause). Because filters are desugared to invocations of filter, the
result type will switch to a Map at that point. Here are some examples:
scala> import org.scalactic.anyvals._ import org.scalactic.anyvals._ scala> for ((i, j) <- NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three")) yield (i + 1, j) res0: org.scalactic.anyvals.NonEmptyMap[Int, String] = NonEmptyMap(2 -> "one", 3 -> "two", 4 -> "three") scala> for ((i, j) <- NonEmptyMap(1, 2, 3) if i < 10) yield (i + 1, j) res1: Map[Int, String] = Map(2 -> "one", 3 -> "two", 4 -> "three")
- K
- the type of key contained in this - NonEmptyMap
- V
- the type of value contained in this - NonEmptyMap
- Source
- NonEmptyMap.scala
- Alphabetic
- By Inheritance
- NonEmptyMap
- AnyVal
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
-   final  def !=(arg0: Any): Boolean- Definition Classes
- Any
 
-   final  def ##: Int- Definition Classes
- Any
 
-    def +[V1 >: V](entries: (K, V1)*): NonEmptyMap[K, V1]Returns a new NonEmptyMapwith the given entries added.Returns a new NonEmptyMapwith the given entries added.- entries
- the entries to add to this - NonEmptyMap
- returns
- a new - NonEmptyMapconsisting of all entries of this- NonEmptyMapand- entries.
 
-    def +[V1 >: V](entry: (K, V1)): NonEmptyMap[K, V1]Returns a new NonEmptyMapwith the given entry added.Returns a new NonEmptyMapwith the given entry added.- entry
- the entry to add to this - NonEmptyMap
- returns
- a new - NonEmptyMapconsisting of all entries of this- NonEmptyMapand- entry.
 
-    def ++[V1 >: V](other: IterableOnce[(K, V1)]): NonEmptyMap[K, V1]Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedGenTraversableOnce.Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedGenTraversableOnce. The entry type of the resultingNonEmptyMapis the most specific superclass encompassing the entry types of thisNonEmptyMapand the passedGenTraversableOnce.- V1
- the value type of the returned - NonEmptyMap
- other
- the - GenTraversableOnceto append
- returns
- a new - NonEmptyMapthat contains all the elements of this- NonEmptyMapfollowed by all elements of- other.
 
-    def ++[V1 >: V](other: Every[(K, V1)]): NonEmptyMap[K, V1]Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedEvery.Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedEvery. The entry type of the resultingNonEmptyMapis the most specific superclass encompassing the entry types of thisNonEmptyMapand the passedEvery.- V1
- the value type of the returned - NonEmptyMap
- other
- the - Everyto append
- returns
- a new - NonEmptyMapthat contains all the entries of this- NonEmptyMapand all elements of- other.
 
-    def ++[V1 >: V](other: NonEmptyMap[K, V1]): NonEmptyMap[K, V1]Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedNonEmptyMap.Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedNonEmptyMap. The entry type of the resultingNonEmptyMapis the most specific superclass encompassing the entry types of this and the passedNonEmptyMap.- V1
- the value type of the returned - NonEmptyMap
- other
- the - NonEmptyMapto append
- returns
- a new - NonEmptyMapthat contains all the elements of this- NonEmptyMapand all elements of- other.
 
-    def ++:[V1 >: V](other: IterableOnce[(K, V1)]): NonEmptyMap[K, V1]Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedGenTraversableOnce.Returns a new NonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedGenTraversableOnce. The entry type of the resultingNonEmptyMapis the most specific superclass encompassing the entry types of thisNonEmptyMapand the passedGenTraversableOnce.- V1
- the value type of the returned - NonEmptyMap
- other
- the - GenTraversableOnceto append
- returns
- a new - NonEmptyMapthat contains all the elements of this- NonEmptyMapfollowed by all elements of- other.
 
-    def ++:[V1 >: V](other: Every[(K, V1)]): NonEmptyMap[K, V1]As with ++, returns a newNonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedEvery.As with ++, returns a newNonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedEvery. The entry type of the resultingNonEmptyMapis the most specific superclass encompassing the entry types of thisNonEmptyMapand the passedEvery.It differs from ++in that the right operand determines the type of the resulting collection rather than the left one. Mnemonic: the COLon is on the side of the new COLlection type.- V1
- the value type of the returned - NonEmptyMap
- other
- the - Everyto append
- returns
- a new - NonEmptyMapthat contains all the entries of this- NonEmptyMapand all elements of- other.
 
-    def ++:[V1 >: V](other: NonEmptyMap[K, V1]): NonEmptyMap[K, V1]As with ++, returns a newNonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedNonEmptyMap.As with ++, returns a newNonEmptyMapcontaining the entries of thisNonEmptyMapand the entries of the passedNonEmptyMap. The entry type of the resultingNonEmptyMapis the most specific superclass encompassing the entry types of this and the passedNonEmptyMap.It differs from ++in that the right operand determines the type of the resulting collection rather than the left one. Mnemonic: the COLon is on the side of the new COLlection type.- V1
- the value type of the returned - NonEmptyMap
- other
- the - NonEmptyMapto add
- returns
- a new - NonEmptyMapthat contains all the elements of this- NonEmptyMapand all elements of- other.
 
-   final  def +:[V1 >: V](entry: (K, V1)): NonEmptyMap[K, V1]Returns a new NonEmptyMapwith the given entry added.Returns a new NonEmptyMapwith the given entry added.Note that :-ending operators are right associative. A mnemonic for +:vs.:+is: the COLon goes on the COLlection side.- entry
- the element to add to this - NonEmptyMap
- returns
- a new - NonEmptyMapconsisting of- elementfollowed by all elements of this- NonEmptyMap.
 
-   final  def ==(arg0: Any): Boolean- Definition Classes
- Any
 
-   final  def addString(sb: StringBuilder, start: String, sep: String, end: String): StringBuilderAppends all entries of this NonEmptyMapto a string builder using start, end, and separator strings.Appends all entries of this NonEmptyMapto a string builder using start, end, and separator strings. The written text will consist of a concatenation of the stringstart; the result of invokingtoStringon all elements of thisNonEmptyMap, separated by the stringsep; and the stringend- sb
- the string builder to which elements will be appended 
- start
- the ending string 
- sep
- the separator string 
- returns
- the string builder, - sb, to which elements were appended.
 
-   final  def addString(sb: StringBuilder, sep: String): StringBuilderAppends all entries of this NonEmptyMapto a string builder using a separator string.Appends all entries of this NonEmptyMapto a string builder using a separator string. The written text will consist of a concatenation of the result of invokingtoStringon of every element of thisNonEmptyMap, separated by the stringsep.- sb
- the string builder to which entries will be appended 
- sep
- the separator string 
- returns
- the string builder, - sb, to which elements were appended.
 
-   final  def addString(sb: StringBuilder): StringBuilderAppends all entries of this NonEmptyMapto a string builder.Appends all entries of this NonEmptyMapto a string builder. The written text will consist of a concatenation of the result of invokingtoStringon of every entry of thisNonEmptyMap, without any separator string.- sb
- the string builder to which entries will be appended 
- returns
- the string builder, - sb, to which entries were appended.
 
-   final  def apply(k: K): VSelects an value by its key in the NonEmptyMap.Selects an value by its key in the NonEmptyMap.- returns
- the value of this - NonEmptyMapat key- k.
 
-   final  def asInstanceOf[T0]: T0- Definition Classes
- Any
 
-   final  def collectFirst[U](pf: PartialFunction[(K, V), U]): Option[U]Finds the first entry of this NonEmptyMapfor which the given partial function is defined, if any, and applies the partial function to it.Finds the first entry of this NonEmptyMapfor which the given partial function is defined, if any, and applies the partial function to it.- pf
- the partial function 
- returns
- an - Optioncontaining- pfapplied to the first entry for which it is defined, or- Noneif the partial function was not defined for any entry.
 
-   final  def contains(key: K): BooleanIndicates whether this NonEmptyMapcontains a binding for given key.Indicates whether this NonEmptyMapcontains a binding for given key.- key
- the key to look for 
- returns
- true if this - NonEmptyMaphas a binding that is equal (as determined by- ==)to- key, false otherwise.
 
-   final  def copyToArray[V1 >: V](arr: Array[(K, V1)], start: Int, len: Int): UnitCopies entries of this NonEmptyMapto an array.Copies entries of this NonEmptyMapto an array. Fills the given arrayarrwith at mostlenentries of thisNonEmptyMap, beginning at indexstart. Copying will stop once either the end of the currentNonEmptyMapis reached, the end of the array is reached, orlenelements have been copied.- arr
- the array to fill 
- start
- the starting index 
- len
- the maximum number of elements to copy 
 
-   final  def copyToArray[V1 >: V](arr: Array[(K, V1)], start: Int): UnitCopies entries of this NonEmptyMapto an array.Copies entries of this NonEmptyMapto an array. Fills the given arrayarrwith entries of thisNonEmptyMap, beginning at indexstart. Copying will stop once either the end of the currentNonEmptyMapis reached, or the end of the array is reached.- arr
- the array to fill 
- start
- the starting index 
 
-   final  def copyToArray[V1 >: V](arr: Array[(K, V1)]): UnitCopies entries of this NonEmptyMapto an array.Copies entries of this NonEmptyMapto an array. Fills the given arrayarrwith entries of thisNonEmptyMap. Copying will stop once either the end of the currentNonEmptyMapis reached, or the end of the array is reached.- arr
- the array to fill 
 
-   final  def copyToBuffer[V1 >: V](buf: Buffer[(K, V1)]): UnitCopies all elements of this NonEmptyMapto a buffer.Copies all elements of this NonEmptyMapto a buffer.- buf
- the buffer to which elements are copied 
 
-   final  def count(p: ((K, V)) => Boolean): IntCounts the number of elements in this NonEmptyMapthat satisfy a predicate.Counts the number of elements in this NonEmptyMapthat satisfy a predicate.- p
- the predicate used to test elements. 
- returns
- the number of elements satisfying the predicate - p.
 
-   final  def exists(p: ((K, V)) => Boolean): BooleanIndicates whether a predicate holds for at least one of the entries of this NonEmptyMap.Indicates whether a predicate holds for at least one of the entries of this NonEmptyMap.- p
- the predicate used to test entries. 
- returns
- trueif the given predicate- pholds for some of the entries of this- NonEmptyMap, otherwise- false.
 
-   final  def find(p: ((K, V)) => Boolean): Option[(K, V)]Finds the first entry of this NonEmptyMapthat satisfies the given predicate, if any.Finds the first entry of this NonEmptyMapthat satisfies the given predicate, if any.- p
- the predicate used to test elements 
- returns
- an - Somecontaining the first element in this- NonEmptyMapthat satisfies- p, or- Noneif none exists.
 
-   final  def flatMap[K1, V1](f: ((K, V)) => NonEmptyMap[K1, V1]): NonEmptyMap[K1, V1]Builds a new NonEmptyMapby applying a function to all entries of thisNonEmptyMapand using the entries of the resultingNonEmptyMaps.Builds a new NonEmptyMapby applying a function to all entries of thisNonEmptyMapand using the entries of the resultingNonEmptyMaps.- K1
- the key type of the returned - NonEmptyMap
- V1
- the value type of the returned - NonEmptyMap
- f
- the function to apply to each entry. 
- returns
- a new - NonEmptyMapcontaining entries obtained by applying the given function- fto each entry of this- NonEmptyMapand concatenating the entries of resulting- NonEmptyMaps.
 
-   final  def fold[U >: (K, V)](z: U)(op: (U, U) => U): UFolds the entries of this NonEmptyMapusing the specified associative binary operator.Folds the entries of this NonEmptyMapusing the specified associative binary operator.The order in which operations are performed on entries is unspecified and may be nondeterministic. - U
- a type parameter for the binary operator, a supertype of (K, V). 
- z
- a neutral element for the fold operation; may be added to the result an arbitrary number of times, and must not change the result (e.g., - Nilfor list concatenation, 0 for addition, or 1 for multiplication.)
- op
- a binary operator that must be associative 
- returns
- the result of applying fold operator - opbetween all the elements and- z
 
-   final  def foldLeft[B](z: B)(op: (B, (K, V)) => B): BApplies a binary operator to a start value and all elements of this NonEmptyMap, going left to right.Applies a binary operator to a start value and all elements of this NonEmptyMap, going left to right.- B
- the result type of the binary operator. 
- z
- the start value. 
- op
- the binary operator. 
- returns
- the result of inserting - opbetween consecutive entries of this- NonEmptyMap, going left to right, with the start value,- z, on the left:- op(...op(op(z, x_1), x_2), ..., x_n) where x1, ..., xn are the elements of this- NonEmptyMap.
 
-   final  def foldRight[B](z: B)(op: ((K, V), B) => B): BApplies a binary operator to all entries of this NonEmptyMapand a start value, going right to left.Applies a binary operator to all entries of this NonEmptyMapand a start value, going right to left.- B
- the result of the binary operator 
- z
- the start value 
- op
- the binary operator 
- returns
- the result of inserting - opbetween consecutive entries of this- NonEmptyMap, going right to left, with the start value,- z, on the right:- op(x_1, op(x_2, ... op(x_n, z)...)) where x1, ..., xn are the elements of this- NonEmptyMap.
 
-   final  def forall(p: ((K, V)) => Boolean): BooleanIndicates whether a predicate holds for all entries of this NonEmptyMap.Indicates whether a predicate holds for all entries of this NonEmptyMap.- p
- the predicate used to test entries. 
- returns
- trueif the given predicate- pholds for all entries of this- NonEmptyMap, otherwise- false.
 
-   final  def foreach(f: ((K, V)) => Unit): UnitApplies a function fto all entries of thisNonEmptyMap.Applies a function fto all entries of thisNonEmptyMap.- f
- the function that is applied for its side-effect to every entry. The result of function - fis discarded.
 
-    def getClass(): Class[_ <: AnyVal]- Definition Classes
- AnyVal → Any
 
-   final  def groupBy(f: ((K, V)) => K): Map[K, NonEmptyMap[K, V]]Partitions this NonEmptyMapinto a map ofNonEmptyMaps according to some discriminator function.Partitions this NonEmptyMapinto a map ofNonEmptyMaps according to some discriminator function.- f
- the discriminator function. 
- returns
- A map from keys to - NonEmptyMaps such that the following invariant holds:- (nonEmptyMap.toMap partition f)(k) = xs filter (x => f(x) == k) That is, every key- kis bound to a- NonEmptyMapof those elements- xfor which- f(x)equals- k.
 
-   final  def grouped(size: Int): Iterator[NonEmptyMap[K, V]]Partitions entries into fixed size NonEmptyMaps.Partitions entries into fixed size NonEmptyMaps.- size
- the number of entries per group 
- returns
- An iterator producing - NonEmptyMaps of size- size, except the last will be truncated if the entries don't divide evenly.
 
-   final  def hasDefiniteSize: BooleanReturns trueto indicate thisNonEmptyMaphas a definite size, since allNonEmptyMaps are strict collections.
-   final  def head: (K, V)Selects the first element of this NonEmptyMap.Selects the first element of this NonEmptyMap.- returns
- the first element of this - NonEmptyMap.
 
-   final  def headOption: Option[(K, V)]Selects the first element of this NonEmptyMapand returns it wrapped in aSome.Selects the first element of this NonEmptyMapand returns it wrapped in aSome.- returns
- the first element of this - NonEmptyMap, wrapped in a- Some.
 
-   final  def isDefinedAt(key: K): BooleanTests whether this NonEmptyMapcontains given key.Tests whether this NonEmptyMapcontains given key.- key
- the key to test 
- returns
- true if this - NonEmptyMapcontains a binding for the given- key,- falseotherwise.
 
-   final  def isEmpty: BooleanReturns falseto indicate thisNonEmptyMap, like allNonEmptyMaps, is non-empty.Returns falseto indicate thisNonEmptyMap, like allNonEmptyMaps, is non-empty.- returns
- false 
 
-   final  def isInstanceOf[T0]: Boolean- Definition Classes
- Any
 
-   final  def isTraversableAgain: BooleanReturns trueto indicate thisNonEmptyMap, like allNonEmptyMaps, can be traversed repeatedly.Returns trueto indicate thisNonEmptyMap, like allNonEmptyMaps, can be traversed repeatedly.- returns
- true 
 
-   final  def iterator: Iterator[(K, V)]Creates and returns a new iterator over all elements contained in this NonEmptyMap.Creates and returns a new iterator over all elements contained in this NonEmptyMap.- returns
- the new iterator 
 
-   final  def last: (K, V)Selects the last entry of this NonEmptyMap.Selects the last entry of this NonEmptyMap.- returns
- the last entry of this - NonEmptyMap.
 
-   final  def lastOption: Option[(K, V)]Returns the last element of this NonEmptyMap, wrapped in aSome.Returns the last element of this NonEmptyMap, wrapped in aSome.- returns
- the last element, wrapped in a - Some.
 
-   final  def map[K1, V1](f: ((K, V)) => (K1, V1)): NonEmptyMap[K1, V1]Builds a new NonEmptyMapby applying a function to all entries of thisNonEmptyMap.Builds a new NonEmptyMapby applying a function to all entries of thisNonEmptyMap.- K1
- the key type of the returned - NonEmptyMap.
- V1
- the value type of the returned - NonEmptyMap.
- f
- the function to apply to each element. 
- returns
- a new - NonEmptyMapresulting from applying the given function- fto each element of this- NonEmptyMapand collecting the results.
 
-   final  def max[U >: (K, V)](implicit cmp: Ordering[U]): (K, V)Finds the largest entry. Finds the largest entry. - returns
- the largest entry of this - NonEmptyMap.
 
-   final  def maxBy[U](f: ((K, V)) => U)(implicit cmp: Ordering[U]): (K, V)Finds the largest result after applying the given function to every entry. Finds the largest result after applying the given function to every entry. - returns
- the largest result of applying the given function to every entry of this - NonEmptyMap.
 
-   final  def min[U >: (K, V)](implicit cmp: Ordering[U]): (K, V)Finds the smallest entry. Finds the smallest entry. - returns
- the smallest entry of this - NonEmptyMap.
 
-   final  def minBy[U](f: ((K, V)) => U)(implicit cmp: Ordering[U]): (K, V)Finds the smallest result after applying the given function to every entry. Finds the smallest result after applying the given function to every entry. - returns
- the smallest result of applying the given function to every entry of this - NonEmptyMap.
 
-   final  def mkString(start: String, sep: String, end: String): StringDisplays all entries of this NonEmptyMapin a string using start, end, and separator strings.Displays all entries of this NonEmptyMapin a string using start, end, and separator strings.- start
- the starting string. 
- sep
- the separator string. 
- end
- the ending string. 
- returns
- a string representation of this - NonEmptyMap. The resulting string begins with the string- startand ends with the string- end. Inside, In the resulting string, the result of invoking- toStringon all entries of this- NonEmptyMapare separated by the string- sep.
 
-   final  def mkString(sep: String): StringDisplays all entries of this NonEmptyMapin a string using a separator string.Displays all entries of this NonEmptyMapin a string using a separator string.- sep
- the separator string 
- returns
- a string representation of this - NonEmptyMap. In the resulting string, the result of invoking- toStringon all entries of this- NonEmptyMapare separated by the string- sep.
 
-   final  def mkString: StringDisplays all entries of this NonEmptyMapin a string.Displays all entries of this NonEmptyMapin a string.- returns
- a string representation of this - NonEmptyMap. In the resulting string, the result of invoking- toStringon all entries of this- NonEmptyMapfollow each other without any separator string.
 
-   final  def nonEmpty: BooleanReturns trueto indicate thisNonEmptyMap, like allNonEmptyMaps, is non-empty.Returns trueto indicate thisNonEmptyMap, like allNonEmptyMaps, is non-empty.- returns
- true 
 
-   final  def product[U >: (K, V)](implicit num: Numeric[U]): UThe result of multiplying all the entries of this NonEmptyMap.The result of multiplying all the entries of this NonEmptyMap.This method can be invoked for any NonEmptyMap[T]for which an implicitNumeric[T]exists.- returns
- the product of all elements 
 
-   final  def reduce[U >: (K, V)](op: (U, U) => U): UReduces the entries of this NonEmptyMapusing the specified associative binary operator.Reduces the entries of this NonEmptyMapusing the specified associative binary operator.The order in which operations are performed on entries is unspecified and may be nondeterministic. - U
- a type parameter for the binary operator, a supertype of T. 
- op
- a binary operator that must be associative. 
- returns
- the result of applying reduce operator - opbetween all the elements of this- NonEmptyMap.
 
-   final  def reduceLeft[U >: (K, V)](op: (U, (K, V)) => U): UApplies a binary operator to all entries of this NonEmptyMap, going left to right.Applies a binary operator to all entries of this NonEmptyMap, going left to right.- U
- the result type of the binary operator. 
- op
- the binary operator. 
- returns
- the result of inserting - opbetween consecutive entries of this- NonEmptyMap, going left to right:- op(...op(op(x_1, x_2), x_3), ..., x_n) where x1, ..., xn are the elements of this- NonEmptyMap.
 
-   final  def reduceLeftOption[U >: (K, V)](op: (U, (K, V)) => U): Option[U]Applies a binary operator to all entries of this NonEmptyMap, going left to right, returning the result in aSome.Applies a binary operator to all entries of this NonEmptyMap, going left to right, returning the result in aSome.- U
- the result type of the binary operator. 
- op
- the binary operator. 
- returns
- a - Somecontaining the result of- reduceLeft(op)
 
-  final def reduceOption[U >: (K, V)](op: (U, U) => U): Option[U]
-   final  def reduceRight[U >: (K, V)](op: ((K, V), U) => U): UApplies a binary operator to all entries of this NonEmptyMap, going right to left.Applies a binary operator to all entries of this NonEmptyMap, going right to left.- U
- the result of the binary operator 
- op
- the binary operator 
- returns
- the result of inserting - opbetween consecutive entries of this- NonEmptyMap, going right to left:- op(x_1, op(x_2, ... op(x_{n-1}, x_n)...))where x1, ..., xn are the entries of this- NonEmptyMap.
 
-   final  def reduceRightOption[U >: (K, V)](op: ((K, V), U) => U): Option[U]Applies a binary operator to all entries of this NonEmptyMap, going right to left, returning the result in aSome.Applies a binary operator to all entries of this NonEmptyMap, going right to left, returning the result in aSome.- U
- the result of the binary operator 
- op
- the binary operator 
- returns
- a - Somecontaining the result of- reduceRight(op)
 
-   final  def sameElements[V1 >: V](that: NonEmptyMap[K, V1]): BooleanChecks if the given NonEmptyMapcontains the same entries in the same order as thisNonEmptyMap.Checks if the given NonEmptyMapcontains the same entries in the same order as thisNonEmptyMap.- that
- the - NonEmptyMapwith which to compare
- returns
- true, if both this and the given- NonEmptyMapcontain the same entries in the same order,- falseotherwise.
 
-   final  def sameElements[U >: (K, V)](that: Every[U]): BooleanChecks if the given Everycontains the same entries in the same order as thisNonEmptyMap.Checks if the given Everycontains the same entries in the same order as thisNonEmptyMap.- that
- the - Everywith which to compare
- returns
- true, if both this and the given- Everycontain the same entries in the same order,- falseotherwise.
 
-   final  def sameElements[U >: (K, V)](that: GenIterable[U]): BooleanChecks if the given GenIterablecontains the same entries in the same order as thisNonEmptyMap.Checks if the given GenIterablecontains the same entries in the same order as thisNonEmptyMap.- that
- the - GenIterablewith which to compare
- returns
- true, if both this- NonEmptyMapand the given- GenIterablecontain the same entries in the same order,- falseotherwise.
 
-   final  def scan[V1 >: V](z: (K, V1))(op: ((K, V1), (K, V1)) => (K, V1)): NonEmptyMap[K, V1]Computes a prefix scan of the entries of this NonEmptyMap.Computes a prefix scan of the entries of this NonEmptyMap.Note: The neutral element z may be applied more than once. - z
- a neutral element for the scan operation; may be added to the result an arbitrary number of times, and must not change the result (e.g., - Nilfor list concatenation, 0 for addition, or 1 for multiplication.)
- op
- a binary operator that must be associative 
- returns
- a new - NonEmptyMapcontaining the prefix scan of the elements in this- NonEmptyMap
 
-   final  def size: IntThe size of this NonEmptyMap.The size of this NonEmptyMap.Note: lengthandsizeyield the same result, which will be>= 1.- returns
- the number of elements in this - NonEmptyMap.
 
-   final  def sliding(size: Int, step: Int): Iterator[NonEmptyMap[K, V]]Groups entries in fixed size blocks by passing a “sliding window” over them (as opposed to partitioning them, as is done in grouped.), moving the sliding window by a given stepeach time.Groups entries in fixed size blocks by passing a “sliding window” over them (as opposed to partitioning them, as is done in grouped.), moving the sliding window by a given stepeach time.- size
- the number of entries per group 
- step
- the distance between the first entries of successive groups 
- returns
- an iterator producing - NonEmptyMaps of size- size, except the last and the only element will be truncated if there are fewer elements than- size.
 
-   final  def sliding(size: Int): Iterator[NonEmptyMap[K, V]]Groups entries in fixed size blocks by passing a “sliding window” over them (as opposed to partitioning them, as is done in grouped.) Groups entries in fixed size blocks by passing a “sliding window” over them (as opposed to partitioning them, as is done in grouped.) - size
- the number of entries per group 
- returns
- an iterator producing - NonEmptyMaps of size- size, except the last and the only element will be truncated if there are fewer entries than- size.
 
-    def stringPrefix: StringReturns "NonEmptyMap", the prefix of this object'stoStringrepresentation.Returns "NonEmptyMap", the prefix of this object'stoStringrepresentation.- returns
- the string - "NonEmptyMap"
 
-   final  def sum[U >: (K, V)](implicit num: Numeric[U]): UThe result of summing all the elements of this NonEmptyMap.The result of summing all the elements of this NonEmptyMap.This method can be invoked for any NonEmptyMap[T]for which an implicitNumeric[T]exists.- returns
- the sum of all elements 
 
-   final  def to[Col[_]](factory: Factory[(K, V), Col[(K, V)]]): Col[(K, V)]Converts this NonEmptyMapinto a collection of typeColby copying all entries.Converts this NonEmptyMapinto a collection of typeColby copying all entries.- Col
- the collection type to build. 
- returns
- a new collection containing all entries of this - NonEmptyMap.
 
-   final  def toArray[U >: (K, V)](implicit classTag: ClassTag[U]): Array[U]Converts this NonEmptyMapto an array.Converts this NonEmptyMapto an array.- returns
- an array containing all entries of this - NonEmptyMap. A- ClassTagmust be available for the entry type of this- NonEmptyMap.
 
-   final  def toBuffer[U >: (K, V)]: Buffer[U]Converts this NonEmptyMapto a mutable buffer.Converts this NonEmptyMapto a mutable buffer.- returns
- a buffer containing all entries of this - NonEmptyMap.
 
-   final  def toIndexedSeq: IndexedSeq[(K, V)]Converts this NonEmptyMapto an immutableIndexedSeq.Converts this NonEmptyMapto an immutableIndexedSeq.- returns
- an immutable - IndexedSeqcontaining all entries of this- NonEmptyMap.
 
-   final  def toIterable: Iterable[(K, V)]Converts this NonEmptyMapto an iterable collection.Converts this NonEmptyMapto an iterable collection.- returns
- an - Iterablecontaining all entries of this- NonEmptyMap.
 
-   final  def toIterator: Iterator[(K, V)]Returns an Iteratorover the entries in thisNonEmptyMap.Returns an Iteratorover the entries in thisNonEmptyMap.- returns
- an - Iteratorcontaining all entries of this- NonEmptyMap.
 
-  val toMap: Map[K, V]
-   final  def toSeq: Seq[(K, V)]Converts this NonEmptyMapto an immutableIndexedSeq.Converts this NonEmptyMapto an immutableIndexedSeq.- returns
- an immutable - IndexedSeqcontaining all entries of this- NonEmptyMap.
 
-   final  def toSet[U >: (K, V)]: Set[U]Converts this NonEmptyMapto a set.Converts this NonEmptyMapto a set.- returns
- a set containing all entries of this - NonEmptyMap.
 
-   final  def toStream: Stream[(K, V)]Converts this NonEmptyMapto a stream.Converts this NonEmptyMapto a stream.- returns
- a stream containing all entries of this - NonEmptyMap.
 
-    def toString(): StringReturns a string representation of this NonEmptyMap.Returns a string representation of this NonEmptyMap.- returns
- the string - "NonEmptyMap"followed by the result of invoking- toStringon this- NonEmptyMap's elements, surrounded by parentheses.
 - Definition Classes
- NonEmptyMap → Any
 
-   final  def toVector: Vector[(K, V)]Converts this NonEmptyMapto aVector.Converts this NonEmptyMapto aVector.- returns
- a - Vectorcontaining all entries of this- NonEmptyMap.
 
-   final  def unzip[L, R](implicit asPair: ((K, V)) => (L, R)): (Iterable[L], Iterable[R])Converts this NonEmptyMapof pairs into twoIterables of the first and second half of each pair.Converts this NonEmptyMapof pairs into twoIterables of the first and second half of each pair.- L
- the type of the first half of the element pairs 
- R
- the type of the second half of the element pairs 
- asPair
- an implicit conversion that asserts that the element type of this - NonEmptyMapis a pair.
- returns
- a pair of - NonEmptyMaps, containing the first and second half, respectively, of each element pair of this- NonEmptyMap.
 
-   final  def unzip3[L, M, R](implicit asTriple: ((K, V)) => (L, M, R)): (Iterable[L], Iterable[M], Iterable[R])Converts this NonEmptyMapof triples into threeNonEmptyMaps of the first, second, and and third entry of each triple.Converts this NonEmptyMapof triples into threeNonEmptyMaps of the first, second, and and third entry of each triple.- L
- the type of the first member of the entry triples 
- R
- the type of the third member of the entry triples 
- asTriple
- an implicit conversion that asserts that the entry type of this - NonEmptyMapis a triple.
- returns
- a triple of - NonEmptyMaps, containing the first, second, and third member, respectively, of each entry triple of this- NonEmptyMap.
 
-   final  def updated[V1 >: V](key: K, value: V1): NonEmptyMap[K, V1]A copy of this NonEmptyMapwith one single replaced entry.A copy of this NonEmptyMapwith one single replaced entry.- key
- the key of the replacement 
- value
- the replacing value 
- returns
- a copy of this - NonEmptyMapwith the value at- keyreplaced by the given- value.
 
-   final  def zipAll[O, V1 >: V](other: Iterable[O], thisElem: (K, V1), otherElem: O): NonEmptyMap[(K, V1), O]Returns a NonEmptyMapformed from thisNonEmptyMapand an iterable collection by combining corresponding entries in pairs.Returns a NonEmptyMapformed from thisNonEmptyMapand an iterable collection by combining corresponding entries in pairs. If one of the two collections is shorter than the other, placeholder entries will be used to extend the shorter collection to the length of the longer.- O
- the type of the second half of the returned pairs 
- V1
- the subtype of the value type of this - NonEmptyMap
- other
- the - Iterableproviding the second half of each result pair
- thisElem
- the element to be used to fill up the result if this - NonEmptyMapis shorter than- that- Iterable.
- otherElem
- the element to be used to fill up the result if - that- Iterableis shorter than this- NonEmptyMap.
- returns
- a new - NonEmptyMapcontaining pairs consisting of corresponding entries of this- NonEmptyMapand- that. The length of the returned collection is the maximum of the lengths of this- NonEmptyMapand- that. If this- NonEmptyMapis shorter than- that,- thisElemvalues are used to pad the result. If- thatis shorter than this- NonEmptyMap,- thatElemvalues are used to pad the result.
 
-   final  def zipWithIndex[V1 >: V]: NonEmptyMap[(K, V1), Int]Zips this NonEmptyMapwith its indices.Zips this NonEmptyMapwith its indices.- returns
- A new - NonEmptyMapcontaining pairs consisting of all elements of this- NonEmptyMappaired with their index. Indices start at 0.