Returns a new NonEmptyMap with the given entries added.
Returns a new NonEmptyMap with the given entries added.
the entries to add to this NonEmptyMap
a new NonEmptyMap consisting of all entries of this NonEmptyMap and entries.
Returns a new NonEmptyMap with the given entry added.
Returns a new NonEmptyMap with the given entry added.
the entry to add to this NonEmptyMap
a new NonEmptyMap consisting of all entries of this NonEmptyMap and entry.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed GenTraversableOnce.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed GenTraversableOnce.
The entry type of the resulting NonEmptyMap is the most specific superclass encompassing the entry types of this NonEmptyMap
and the passed GenTraversableOnce.
the value type of the returned NonEmptyMap
the GenTraversableOnce to append
a new NonEmptyMap that contains all the elements of this NonEmptyMap followed by all elements of other.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed Every.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed Every.
The entry type of the resulting NonEmptyMap is the most specific superclass encompassing the entry types of this NonEmptyMap and the passed Every.
the value type of the returned NonEmptyMap
the Every to append
a new NonEmptyMap that contains all the entries of this NonEmptyMap and all elements of other.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed NonEmptyMap.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed NonEmptyMap.
The entry type of the resulting NonEmptyMap is the most specific superclass encompassing the entry types of this and the passed NonEmptyMap.
the value type of the returned NonEmptyMap
the NonEmptyMap to append
a new NonEmptyMap that contains all the elements of this NonEmptyMap and all elements of other.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed GenTraversableOnce.
Returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed GenTraversableOnce.
The entry type of the resulting NonEmptyMap is the most specific superclass encompassing the entry types of this NonEmptyMap
and the passed GenTraversableOnce.
the value type of the returned NonEmptyMap
the GenTraversableOnce to append
a new NonEmptyMap that contains all the elements of this NonEmptyMap followed by all elements of other.
As with ++, returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed Every.
As with ++, returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed Every.
The entry type of the resulting NonEmptyMap is the most specific superclass encompassing the entry types of this NonEmptyMap and the passed Every.
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.
the value type of the returned NonEmptyMap
the Every to append
a new NonEmptyMap that contains all the entries of this NonEmptyMap and all elements of other.
As with ++, returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed NonEmptyMap.
As with ++, returns a new NonEmptyMap containing the entries of this NonEmptyMap and the entries of the passed NonEmptyMap.
The entry type of the resulting NonEmptyMap is the most specific superclass encompassing the entry types of this and the passed NonEmptyMap.
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.
the value type of the returned NonEmptyMap
the NonEmptyMap to add
a new NonEmptyMap that contains all the elements of this NonEmptyMap and all elements of other.
Returns a new NonEmptyMap with the given entry added.
Returns a new NonEmptyMap with the given entry added.
Note that :-ending operators are right associative. A mnemonic for +: vs. :+ is: the COLon goes on the COLlection side.
the element to add to this NonEmptyMap
a new NonEmptyMap consisting of element followed by all elements of this NonEmptyMap.
Appends all entries of this NonEmptyMap to a string builder using start, end, and separator strings.
Appends all entries of this NonEmptyMap to a string builder using start, end, and separator strings. The written text will consist of a concatenation of
the string start; the result of invoking toString on all elements of this NonEmptyMap,
separated by the string sep; and the string end
the string builder to which elements will be appended
the ending string
the separator string
the string builder, sb, to which elements were appended.
Appends all entries of this NonEmptyMap to a string builder using a separator string.
Appends all entries of this NonEmptyMap to a string builder using a separator string. The written text will consist of a concatenation of the
result of invoking toString
on of every element of this NonEmptyMap, separated by the string sep.
the string builder to which entries will be appended
the separator string
the string builder, sb, to which elements were appended.
Appends all entries of this NonEmptyMap to a string builder.
Appends all entries of this NonEmptyMap to a string builder. The written text will consist of a concatenation of the result of invoking toString
on of every entry of this NonEmptyMap, without any separator string.
the string builder to which entries will be appended
the string builder, sb, to which entries were appended.
Selects an value by its key in the NonEmptyMap.
Selects an value by its key in the NonEmptyMap.
the value of this NonEmptyMap at key k.
Finds the first entry of this NonEmptyMap for which the given partial function is defined, if any, and applies the partial function to it.
Finds the first entry of this NonEmptyMap for which the given partial function is defined, if any, and applies the partial function to it.
the partial function
an Option containing pf applied to the first entry for which it is defined, or None if
the partial function was not defined for any entry.
Indicates whether this NonEmptyMap contains a binding for given key.
Indicates whether this NonEmptyMap contains a binding for given key.
the key to look for
true if this NonEmptyMap has a binding that is equal (as determined by ==) to key, false otherwise.
Copies entries of this NonEmptyMap to an array.
Copies entries of this NonEmptyMap to an array. Fills the given array arr with at most len entries of this NonEmptyMap, beginning at
index start. Copying will stop once either the end of the current NonEmptyMap is reached, the end of the array is reached, or
len elements have been copied.
the array to fill
the starting index
the maximum number of elements to copy
Copies entries of this NonEmptyMap to an array.
Copies entries of this NonEmptyMap to an array. Fills the given array arr with entries of this NonEmptyMap, beginning at
index start. Copying will stop once either the end of the current NonEmptyMap is reached, or the end of the array is reached.
the array to fill
the starting index
Copies entries of this NonEmptyMap to an array.
Copies entries of this NonEmptyMap to an array. Fills the given array arr with entries of this NonEmptyMap. Copying
will stop once either the end of the current NonEmptyMap is reached, or the end of the array is reached.
the array to fill
Copies all elements of this NonEmptyMap to a buffer.
Copies all elements of this NonEmptyMap to a buffer.
the buffer to which elements are copied
Counts the number of elements in this NonEmptyMap that satisfy a predicate.
Counts the number of elements in this NonEmptyMap that satisfy a predicate.
the predicate used to test elements.
the number of elements satisfying the predicate p.
Indicates 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.
the predicate used to test entries.
true if the given predicate p holds for some of the entries of this NonEmptyMap, otherwise false.
Finds the first entry of this NonEmptyMap that satisfies the given predicate, if any.
Finds the first entry of this NonEmptyMap that satisfies the given predicate, if any.
the predicate used to test elements
an Some containing the first element in this NonEmptyMap that satisfies p, or None if none exists.
Builds a new NonEmptyMap by applying a function to all entries of this NonEmptyMap and using the entries of the resulting NonEmptyMaps.
Builds a new NonEmptyMap by applying a function to all entries of this NonEmptyMap and using the entries of the resulting NonEmptyMaps.
the key type of the returned NonEmptyMap
the value type of the returned NonEmptyMap
the function to apply to each entry.
a new NonEmptyMap containing entries obtained by applying the given function f to each entry of this NonEmptyMap and concatenating
the entries of resulting NonEmptyMaps.
Folds the entries of this NonEmptyMap using the specified associative binary operator.
Folds the entries of this NonEmptyMap using the specified associative binary operator.
The order in which operations are performed on entries is unspecified and may be nondeterministic.
a type parameter for the binary operator, a supertype of (K, V).
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., Nil for list concatenation,
0 for addition, or 1 for multiplication.)
a binary operator that must be associative
the result of applying fold operator op between all the elements and z
Applies 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.
the result type of the binary operator.
the start value.
the binary operator.
the result of inserting op between 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.
Applies a binary operator to all entries of this NonEmptyMap and a start value, going right to left.
Applies a binary operator to all entries of this NonEmptyMap and a start value, going right to left.
the result of the binary operator
the start value
the binary operator
the result of inserting op between 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.
Indicates whether a predicate holds for all entries of this NonEmptyMap.
Indicates whether a predicate holds for all entries of this NonEmptyMap.
the predicate used to test entries.
true if the given predicate p holds for all entries of this NonEmptyMap, otherwise false.
Applies a function f to all entries of this NonEmptyMap.
Applies a function f to all entries of this NonEmptyMap.
the function that is applied for its side-effect to every entry. The result of function f is discarded.
Partitions this NonEmptyMap into a map of NonEmptyMaps according to some discriminator function.
Partitions this NonEmptyMap into a map of NonEmptyMaps according to some discriminator function.
the discriminator function.
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
k is bound to a NonEmptyMap of those elements x for which f(x) equals k.
Partitions entries into fixed size NonEmptyMaps.
Partitions entries into fixed size NonEmptyMaps.
the number of entries per group
An iterator producing NonEmptyMaps of size size, except the last will be truncated if the entries don't divide evenly.
Returns true to indicate this NonEmptyMap has a definite size, since all NonEmptyMaps are strict collections.
Returns true to indicate this NonEmptyMap has a definite size, since all NonEmptyMaps are strict collections.
Selects the first element of this NonEmptyMap.
Selects the first element of this NonEmptyMap.
the first element of this NonEmptyMap.
Selects the first element of this NonEmptyMap and returns it wrapped in a Some.
Selects the first element of this NonEmptyMap and returns it wrapped in a Some.
the first element of this NonEmptyMap, wrapped in a Some.
Tests whether this NonEmptyMap contains given key.
Tests whether this NonEmptyMap contains given key.
the key to test
true if this NonEmptyMap contains a binding for the given key, false otherwise.
Returns false to indicate this NonEmptyMap, like all NonEmptyMaps, is non-empty.
Returns false to indicate this NonEmptyMap, like all NonEmptyMaps, is non-empty.
false
Returns true to indicate this NonEmptyMap, like all NonEmptyMaps, can be traversed repeatedly.
Returns true to indicate this NonEmptyMap, like all NonEmptyMaps, can be traversed repeatedly.
true
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.
the new iterator
Selects the last entry of this NonEmptyMap.
Selects the last entry of this NonEmptyMap.
the last entry of this NonEmptyMap.
Returns the last element of this NonEmptyMap, wrapped in a Some.
Returns the last element of this NonEmptyMap, wrapped in a Some.
the last element, wrapped in a Some.
Builds a new NonEmptyMap by applying a function to all entries of this NonEmptyMap.
Builds a new NonEmptyMap by applying a function to all entries of this NonEmptyMap.
the key type of the returned NonEmptyMap.
the value type of the returned NonEmptyMap.
the function to apply to each element.
a new NonEmptyMap resulting from applying the given function f to each element of this NonEmptyMap and collecting the results.
Finds the largest entry.
Finds the largest entry.
the largest entry of this NonEmptyMap.
Finds the largest result after applying the given function to every entry.
Finds the largest result after applying the given function to every entry.
the largest result of applying the given function to every entry of this NonEmptyMap.
Finds the smallest entry.
Finds the smallest entry.
the smallest entry of this NonEmptyMap.
Finds the smallest result after applying the given function to every entry.
Finds the smallest result after applying the given function to every entry.
the smallest result of applying the given function to every entry of this NonEmptyMap.
Displays all entries of this NonEmptyMap in a string using start, end, and separator strings.
Displays all entries of this NonEmptyMap in a string using start, end, and separator strings.
the starting string.
the separator string.
the ending string.
a string representation of this NonEmptyMap. The resulting string begins with the string start and ends with the string
end. Inside, In the resulting string, the result of invoking toString on all entries of this NonEmptyMap are
separated by the string sep.
Displays all entries of this NonEmptyMap in a string using a separator string.
Displays all entries of this NonEmptyMap in a string using a separator string.
the separator string
a string representation of this NonEmptyMap. In the resulting string, the result of invoking toString on all entries of this
NonEmptyMap are separated by the string sep.
Displays all entries of this NonEmptyMap in a string.
Displays all entries of this NonEmptyMap in a string.
a string representation of this NonEmptyMap. In the resulting string, the result of invoking toString on all entries of this
NonEmptyMap follow each other without any separator string.
Returns true to indicate this NonEmptyMap, like all NonEmptyMaps, is non-empty.
Returns true to indicate this NonEmptyMap, like all NonEmptyMaps, is non-empty.
true
The 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 implicit Numeric[T] exists.
the product of all elements
Reduces the entries of this NonEmptyMap using the specified associative binary operator.
Reduces the entries of this NonEmptyMap using the specified associative binary operator.
The order in which operations are performed on entries is unspecified and may be nondeterministic.
a type parameter for the binary operator, a supertype of T.
a binary operator that must be associative.
the result of applying reduce operator op between all the elements of this NonEmptyMap.
Applies 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.
the result type of the binary operator.
the binary operator.
the result of inserting op between 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.
Applies a binary operator to all entries of this NonEmptyMap, going left to right, returning the result in a Some.
Applies a binary operator to all entries of this NonEmptyMap, going left to right, returning the result in a Some.
the result type of the binary operator.
the binary operator.
a Some containing the result of reduceLeft(op)
Applies 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.
the result of the binary operator
the binary operator
the result of inserting op between 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.
Applies a binary operator to all entries of this NonEmptyMap, going right to left, returning the result in a Some.
Applies a binary operator to all entries of this NonEmptyMap, going right to left, returning the result in a Some.
the result of the binary operator
the binary operator
a Some containing the result of reduceRight(op)
Checks if the given NonEmptyMap contains the same entries in the same order as this NonEmptyMap.
Checks if the given NonEmptyMap contains the same entries in the same order as this NonEmptyMap.
the NonEmptyMap with which to compare
true, if both this and the given NonEmptyMap contain the same entries
in the same order, false otherwise.
Checks if the given Every contains the same entries in the same order as this NonEmptyMap.
Checks if the given Every contains the same entries in the same order as this NonEmptyMap.
the Every with which to compare
true, if both this and the given Every contain the same entries
in the same order, false otherwise.
Checks if the given GenIterable contains the same entries in the same order as this NonEmptyMap.
Checks if the given GenIterable contains the same entries in the same order as this NonEmptyMap.
the GenIterable with which to compare
true, if both this NonEmptyMap and the given GenIterable contain the same entries
in the same order, false otherwise.
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.
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., Nil for list concatenation,
0 for addition, or 1 for multiplication.)
a binary operator that must be associative
a new NonEmptyMap containing the prefix scan of the elements in this NonEmptyMap
The size of this NonEmptyMap.
The size of this NonEmptyMap.
Note: length and size yield the same result, which will be >= 1.
the number of elements in this NonEmptyMap.
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 step each 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 step each time.
the number of entries per group
the distance between the first entries of successive groups
an iterator producing NonEmptyMaps of size size, except the last and the only element will be truncated
if there are fewer elements than size.
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.)
the number of entries per group
an iterator producing NonEmptyMaps of size size, except the last and the only element will be truncated
if there are fewer entries than size.
Returns "NonEmptyMap", the prefix of this object's toString representation.
Returns "NonEmptyMap", the prefix of this object's toString representation.
the string "NonEmptyMap"
The 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 implicit Numeric[T] exists.
the sum of all elements
Converts this NonEmptyMap into a collection of type Col by copying all entries.
Converts this NonEmptyMap into a collection of type Col by copying all entries.
the collection type to build.
a new collection containing all entries of this NonEmptyMap.
Converts this NonEmptyMap to an array.
Converts this NonEmptyMap to an array.
an array containing all entries of this NonEmptyMap. A ClassTag must be available for the entry type of this NonEmptyMap.
Converts this NonEmptyMap to a mutable buffer.
Converts this NonEmptyMap to a mutable buffer.
a buffer containing all entries of this NonEmptyMap.
Converts this NonEmptyMap to an immutable IndexedSeq.
Converts this NonEmptyMap to an immutable IndexedSeq.
an immutable IndexedSeq containing all entries of this NonEmptyMap.
Converts this NonEmptyMap to an iterable collection.
Converts this NonEmptyMap to an iterable collection.
an Iterable containing all entries of this NonEmptyMap.
Returns an Iterator over the entries in this NonEmptyMap.
Returns an Iterator over the entries in this NonEmptyMap.
an Iterator containing all entries of this NonEmptyMap.
Converts this NonEmptyMap to an immutable IndexedSeq.
Converts this NonEmptyMap to an immutable IndexedSeq.
an immutable IndexedSeq containing all entries of this NonEmptyMap.
Converts this NonEmptyMap to a set.
Converts this NonEmptyMap to a set.
a set containing all entries of this NonEmptyMap.
Converts this NonEmptyMap to a stream.
Converts this NonEmptyMap to a stream.
a stream containing all entries of this NonEmptyMap.
Returns a string representation of this NonEmptyMap.
Returns a string representation of this NonEmptyMap.
the string "NonEmptyMap" followed by the result of invoking toString on
this NonEmptyMap's elements, surrounded by parentheses.
Converts this NonEmptyMap to a Vector.
Converts this NonEmptyMap to a Vector.
a Vector containing all entries of this NonEmptyMap.
Converts this NonEmptyMap of pairs into two Iterables of the first and second half of each pair.
Converts this NonEmptyMap of pairs into two Iterables of the first and second half of each pair.
the type of the first half of the element pairs
the type of the second half of the element pairs
an implicit conversion that asserts that the element type of this NonEmptyMap is a pair.
a pair of NonEmptyMaps, containing the first and second half, respectively, of each element pair of this NonEmptyMap.
Converts this NonEmptyMap of triples into three NonEmptyMaps of the first, second, and and third entry of each triple.
Converts this NonEmptyMap of triples into three NonEmptyMaps of the first, second, and and third entry of each triple.
the type of the first member of the entry triples
the type of the third member of the entry triples
an implicit conversion that asserts that the entry type of this NonEmptyMap is a triple.
a triple of NonEmptyMaps, containing the first, second, and third member, respectively, of each entry triple of this NonEmptyMap.
A copy of this NonEmptyMap with one single replaced entry.
A copy of this NonEmptyMap with one single replaced entry.
the key of the replacement
the replacing value
a copy of this NonEmptyMap with the value at key replaced by the given value.
Returns a NonEmptyMap formed from this NonEmptyMap and an iterable collection by combining corresponding
entries in pairs.
Returns a NonEmptyMap formed from this NonEmptyMap and 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.
the type of the second half of the returned pairs
the subtype of the value type of this NonEmptyMap
the Iterable providing the second half of each result pair
the element to be used to fill up the result if this NonEmptyMap is shorter than that Iterable.
the element to be used to fill up the result if that Iterable is shorter than this NonEmptyMap.
a new NonEmptyMap containing pairs consisting of corresponding entries of this NonEmptyMap and that. The
length of the returned collection is the maximum of the lengths of this NonEmptyMap and that. If this NonEmptyMap
is shorter than that, thisElem values are used to pad the result. If that is shorter than this
NonEmptyMap, thatElem values are used to pad the result.
Zips this NonEmptyMap with its indices.
Zips this NonEmptyMap with its indices.
A new NonEmptyMap containing pairs consisting of all elements of this NonEmptyMap paired with their index. Indices start at 0.
A non-empty map: an ordered, immutable, non-empty collection of key-value tuples with
LinearSeqperformance characteristics.The purpose of
NonEmptyMapis to allow you to express in a type that aMapis non-empty, thereby eliminating the need for (and potential exception from) a run-time check for non-emptiness. For a non-empty sequence withIndexedSeqperformance, seeEvery.Constructing
NonEmptyMapsYou can construct a
NonEmptyMapby passing one or more elements to theNonEmptyMap.applyfactory method:Working with
NonEmptyMapsNonEmptyMapdoes not extend Scala'sMaporTraversabletraits because these require that implementations may be empty. For example, if you invoketailon aSeqthat contains just one element, you'll get an emptySeq:On the other hand, many useful methods exist on
Mapthat when invoked on a non-emptySeqare guaranteed to not result in an emptyMap. For convenience,NonEmptyMapdefines a method corresponding to every suchMapmethod. Here are an example:NonEmptyMapdoes not currently define any methods corresponding toMapmethods that could result in an emptyMap. However, an implicit converison fromNonEmptyMaptoMapis defined in theNonEmptyMapcompanion object that will be applied if you attempt to call one of the missing methods. As a result, you can invokefilteron anNonEmptyMap, even thoughfiltercould result in an empty map—but the result type will beMapinstead ofNonEmptyMap:You can use
NonEmptyMaps inforexpressions. The result will be anNonEmptyMapunless you use a filter (anifclause). Because filters are desugared to invocations offilter, the result type will switch to aMapat that point. Here are some examples:the type of key contained in this
NonEmptyMapthe type of value contained in this
NonEmptyMap