Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 8df5083

Browse files
committed
Make filterKeys and mapValues lazy
1 parent bdd39ae commit 8df5083

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/scala/strawman/collection/Map.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ trait MapOps[K, +V, +CC[X, Y] <: Map[X, Y], +C <: Map[K, V]]
118118
* @return an immutable map consisting only of those key value pairs of this map where the key satisfies
119119
* the predicate `p`. The resulting map wraps the original map without copying any elements.
120120
*/
121-
def filterKeys(p: K => Boolean): CC[K, V @uncheckedVariance] = mapFromIterable(View.FilterKeys(coll, p))
121+
def filterKeys(p: K => Boolean): View[(K, V)] = View.FilterKeys(coll, p)
122122

123123
/** Transforms this map by applying a function to every retrieved value.
124124
* @param f the function used to transform values of this map.
125125
* @return a map view which maps every key of this map
126126
* to `f(this(key))`. The resulting map wraps the original map without copying any elements.
127127
*/
128-
def mapValues[W](f: V => W): CC[K, W] = mapFromIterable(View.MapValues(coll, f))
128+
def mapValues[W](f: V => W): View[(K, W)] = View.MapValues(coll, f)
129129

130130
/** Defines the default value computation for the map,
131131
* returned when a key is not found

0 commit comments

Comments
 (0)