diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/Map.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala index 211158f047..ad3dc29380 100644 --- a/src/library/scala/collection/Map.scala +++ b/src/library/scala/collection/Map.scala @@ -76,6 +76,14 @@ trait Map[A, +B] extends AnyRef case Some(_) => true } + /** @return the keys of this map as a set. + */ + def keySet = new Set[A] { + def size = Map.this.size; + def contains(key : A) = Map.this.contains(key); + def elements = Map.this.elements.map(._1); + } + /** Does this map contain a mapping from the given key to a value? * * @param key the key |