diff options
author | Lex Spoon <lex@lexspoon.org> | 2007-03-23 17:02:14 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2007-03-23 17:02:14 +0000 |
commit | 2464205e534ddca861b113d9771a06859544b997 (patch) | |
tree | 08ea9c68200f43711bb96c500f5e238cfa66ac8d | |
parent | 96fd08897359e2851aad31b7b515225dd02b0195 (diff) | |
download | scala-2464205e534ddca861b113d9771a06859544b997.tar.gz scala-2464205e534ddca861b113d9771a06859544b997.tar.bz2 scala-2464205e534ddca861b113d9771a06859544b997.zip |
renamed getOrElsePut to getOrElseUpdate, which ...
renamed getOrElsePut to getOrElseUpdate, which is more Scala-like
-rw-r--r-- | src/library/scala/collection/mutable/Map.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala index 4c908aed92..d0d9867d1d 100644 --- a/src/library/scala/collection/mutable/Map.scala +++ b/src/library/scala/collection/mutable/Map.scala @@ -160,10 +160,10 @@ trait Map[A, B] extends AnyRef def clear(): Unit = keys foreach -= /** Check if this map maps <code>key</code> to a value. - * Return that value if it exists, otherwise put <code>default</code> - * as that key's value and return it. - */ - def getOrElsePut(key: A, default: B): B = + * Return that value if it exists, otherwise put <code>default</code> + * as that key's value and return it. + */ + def getOrElseUpdate(key: A, default: B): B = get(key) match { case Some(v) => v case None => this(key) = default; default |