summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2003-11-21 15:39:44 +0000
committerburaq <buraq@epfl.ch>2003-11-21 15:39:44 +0000
commitef7ab5ba91e9db260eb8112e4bd546ae1a4447d6 (patch)
tree96c820a3892eea94a3107caed7cd0922630a2ff6 /sources
parentaff70280b8a072ee0601d5748c0dcae3d924d428 (diff)
downloadscala-ef7ab5ba91e9db260eb8112e4bd546ae1a4447d6.tar.gz
scala-ef7ab5ba91e9db260eb8112e4bd546ae1a4447d6.tar.bz2
scala-ef7ab5ba91e9db260eb8112e4bd546ae1a4447d6.zip
added fromList method, but crashed compiler?!
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/collection/immutable/ListMap.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/sources/scala/collection/immutable/ListMap.scala b/sources/scala/collection/immutable/ListMap.scala
index 468010d877..102cdac66f 100644
--- a/sources/scala/collection/immutable/ListMap.scala
+++ b/sources/scala/collection/immutable/ListMap.scala
@@ -11,7 +11,14 @@ package scala.collection.immutable;
object ListMap {
- def Empty[A, B] = new ListMap[A, B];
+ def Empty[A, B] = new ListMap[A, B];
+
+ /** bug: crashes analzyer with NullPointerException */
+ /*
+ def fromList[A,B]( list:List[Pair[A,B]] ):ListMap[A,B] =
+ list.foldLeft (Empty[A,B]) { ( x:ListMap[A,B],y:Pair[A,B] ) =>
+ x.update( y._1, y._2 ) };
+ */
}
/** This class implements immutable maps using a list-based data
@@ -73,3 +80,5 @@ class ListMap[A, B] with Map[A, B, ListMap[A, B]] {
(key.hashCode() ^ value.hashCode()) + ListMap.this.hashCode();
}
}
+
+