diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/immutable/MapLike.scala | 7 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/MapProxy.scala | 1 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/SortedMap.scala | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala index bbad195687..0e2723cf2b 100644 --- a/src/library/scala/collection/immutable/MapLike.scala +++ b/src/library/scala/collection/immutable/MapLike.scala @@ -50,8 +50,6 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] extends scala.collection.MapLike[A, B, This] { self => - import scala.collection.Traversable - /** A new immutable map containing updating this map with a given key/value mapping. * @param key the key * @param value the value @@ -110,6 +108,11 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] def get(key: A) = self.get(key).map(f) } + /** Collects all keys of this map in a set. + * @return a set containing all keys of this map. + */ + override def keySet: immutable.Set[A] = immutable.Set.empty ++ (this map (_._1)) + /** This function transforms all the values of mappings contained * in this map with function `f`. * diff --git a/src/library/scala/collection/immutable/MapProxy.scala b/src/library/scala/collection/immutable/MapProxy.scala index fa0b097070..8313e4d143 100644 --- a/src/library/scala/collection/immutable/MapProxy.scala +++ b/src/library/scala/collection/immutable/MapProxy.scala @@ -35,6 +35,7 @@ trait MapProxy[A, +B] extends Map[A, B] with MapProxyLike[A, B, Map[A, B]] { override def + [B1 >: B](elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *) = newProxy(self.+(elem1, elem2, elems: _*)) override def ++[B1 >: B](xs: TraversableOnce[(A, B1)]) = newProxy(self ++ xs) + override def keySet: immutable.Set[A] = new SetProxy[A] { val self = MapProxy.this.self.keySet } override def filterKeys(p: A => Boolean) = self.filterKeys(p) override def mapValues[C](f: B => C) = self.mapValues(f) } diff --git a/src/library/scala/collection/immutable/SortedMap.scala b/src/library/scala/collection/immutable/SortedMap.scala index f49c4a9986..aa30932bb7 100644 --- a/src/library/scala/collection/immutable/SortedMap.scala +++ b/src/library/scala/collection/immutable/SortedMap.scala @@ -36,8 +36,8 @@ trait SortedMap[A, +B] extends Map[A, B] SortedMap.newBuilder[A, B] override def empty: SortedMap[A, B] = SortedMap.empty - override def updated [B1 >: B](key: A, value: B1): SortedMap[A, B1] = this + ((key, value)) + override def keySet: immutable.SortedSet[A] = SortedSet.empty ++ (this map (_._1)) /** Add a key/value pair to this map. * @param kv the key/value pair |