diff options
-rw-r--r-- | src/library/scala/Predef.scala | 89 |
1 files changed, 1 insertions, 88 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 785546624a..30e1112e50 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -9,7 +9,7 @@ // $Id$ -package scala; +package scala /** The <code>Predef</code> object provides definitions that are @@ -74,93 +74,6 @@ object Predef { type Function[-a,+b] = Function1[a,b] - // arrays ----------------------------------------------------------- - - /** Create an array with given elements. - * - * @param xs the elements to put in the array - * @return the array containing elements xs. - */ - def Array[A <: AnyRef](xs: A*): Array[A] = { - val array = new Array[A](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - - val Array = scala.Array - -/* The following metod clashes with the previous one, and has therefore been - * removed. Note that this is a choice between efficiency and generality. - * The previous factory method is more efficient than the one that has been - * commented out. Since it is anyway possible to create a polymorphic array - * using - * new Array[T] - * it was preferred to restrict the definition of the factory method. - - def Array[A](xs: A*): Array[A] = { - val array = new Array[A](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } -*/ - - def Array(xs: boolean*): Array[boolean] = { - val array = new Array[boolean](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: byte*): Array[byte] = { - val array = new Array[byte](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: short*): Array[short] = { - val array = new Array[short](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: char*): Array[char] = { - val array = new Array[char](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: int*): Array[int] = { - val array = new Array[int](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: long*): Array[long] = { - val array = new Array[long](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: float*): Array[float] = { - val array = new Array[float](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: double*): Array[double] = { - val array = new Array[double](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - def Array(xs: unit*): Array[unit] = { - val array = new Array[unit](xs.length) - var i = 0 - for (val x <- xs.elements) { array(i) = x; i = i + 1; } - array - } - // errors and asserts ------------------------------------------------- def error(message: String): Nothing = throw new Error(message) |