diff options
author | Matthias Zenger <mzenger@gmail.com> | 2003-06-10 09:39:10 +0000 |
---|---|---|
committer | Matthias Zenger <mzenger@gmail.com> | 2003-06-10 09:39:10 +0000 |
commit | 1fbc4f65614dd32e35396c8417901166c059d53b (patch) | |
tree | bb194808140b5fa3693eb593772159af1b3ac1b2 /sources | |
parent | d7d26ea960ff86d4cc4b2896409f5b4cd146458c (diff) | |
download | scala-1fbc4f65614dd32e35396c8417901166c059d53b.tar.gz scala-1fbc4f65614dd32e35396c8417901166c059d53b.tar.bz2 scala-1fbc4f65614dd32e35396c8417901166c059d53b.zip |
Added some more constructors for the collection...
Added some more constructors for the collection classes framework.
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/Predef.scala | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sources/scala/Predef.scala b/sources/scala/Predef.scala index 698cb1fa7e..6626c91189 100644 --- a/sources/scala/Predef.scala +++ b/sources/scala/Predef.scala @@ -12,15 +12,33 @@ object Predef { type boolean = scala.Boolean; type unit = scala.Unit; - def List[a](x: a*): List[a] = x as List[a]; + def List[A](x: A*): List[A] = x as List[A]; val List = scala.List; - def Set[a](es: a*): Set[a] = { - val set = new HashSet[a]; + def Set[A](es: A*): Set[A] = { + val set = new HashSet[A]; set.addSet(es); set; } + def ListSet[A](es: A*): Set[A] = { + val set = new ListSet[A]; + set.addSet(es); + set; + } + + def HashSet[A](es: A*): Set[A] = { + val set = new HashSet[A]; + set.addSet(es); + set; + } + + def Map[A, B](mappings: Pair[A, B]*): Map[A, B] = { + val map = new HashMap[A, B]; + map.putMap(mappings); + map; + } + def error(x: String): All = new java.lang.RuntimeException(x).throw; def try[a](def block: a): Except[a] = |