summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorstenman <stenman@epfl.ch>2004-01-28 14:40:29 +0000
committerstenman <stenman@epfl.ch>2004-01-28 14:40:29 +0000
commit244e7010744283642301251995b9926277219951 (patch)
treedd0707d2755b44a709af28cc7e6b6aab47238c98 /sources
parent4c01efeee52bcdf62241e051ea499928a6a66ee7 (diff)
downloadscala-244e7010744283642301251995b9926277219951.tar.gz
scala-244e7010744283642301251995b9926277219951.tar.bz2
scala-244e7010744283642301251995b9926277219951.zip
Bugfix: Added hashCode() method.
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/collection/immutable/Map.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/sources/scala/collection/immutable/Map.scala b/sources/scala/collection/immutable/Map.scala
index 0dd67df7b1..e5874141e6 100644
--- a/sources/scala/collection/immutable/Map.scala
+++ b/sources/scala/collection/immutable/Map.scala
@@ -146,12 +146,16 @@ trait Map[A, B] with scala.collection.Map[A, B] {
} else
false;
+ override def hashCode() = {
+ elements.foldLeft(0)((hash:Int,E:Object) => hash + E.hashCode());
+ }
+
/** This method controls how a mapping is represented in the string
* representation provided by method <code>toString</code>.
*/
def mappingToString(p: Pair[A, B]) = p._1.toString() + " -> " + p._2;
class MapTo(key: A) {
- def ->(value: B): Map[A, B] = update(key, value);
+ def ->(value: B) = update(key, value);
}
}