summaryrefslogtreecommitdiff
path: root/src/library/scala/Array.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-11-19 04:59:46 +0000
committerPaul Phillips <paulp@improving.org>2009-11-19 04:59:46 +0000
commit6f4e82da32eec2d1be861c8e4ca442d11b9a86cf (patch)
treea338985093fbb0f9fd020cb7f43a646c73501fdb /src/library/scala/Array.scala
parent2a6a02e9a782b7621e3dc79d2f07fca074b11bb6 (diff)
downloadscala-6f4e82da32eec2d1be861c8e4ca442d11b9a86cf.tar.gz
scala-6f4e82da32eec2d1be861c8e4ca442d11b9a86cf.tar.bz2
scala-6f4e82da32eec2d1be861c8e4ca442d11b9a86cf.zip
Restoring an embarassingly large quantity of de...
Restoring an embarassingly large quantity of deprecated methods whose time had not yet come.
Diffstat (limited to 'src/library/scala/Array.scala')
-rw-r--r--src/library/scala/Array.scala42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index a9f07157a0..a323dccffc 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -397,6 +397,48 @@ object Array extends FallbackArrayBuilding {
}
a
}
+
+ /** Create an array containing the values of a given function <code>f</code>
+ * over given range <code>[0..n)</code>
+ */
+ @deprecated("use `Array.tabulate' instead")
+ def fromFunction[T: ClassManifest](f: Int => T)(n: Int): Array[T] = {
+ val a = new Array[T](n)
+ var i = 0
+ while (i < n) {
+ a(i) = f(i)
+ i += 1
+ }
+ a
+ }
+
+ /** Create an array containing the values of a given function <code>f</code>
+ * over given range <code>[0..n1, 0..n2)</code>
+ */
+ @deprecated("use `Array.tabulate' instead")
+ def fromFunction[T: ClassManifest](f: (Int, Int) => T)(n1: Int, n2: Int): Array[Array[T]] =
+ fromFunction(i => fromFunction(f(i, _))(n2))(n1)
+
+ /** Create an array containing the values of a given function <code>f</code>
+ * over given range <code>[0..n1, 0..n2, 0..n3)</code>
+ */
+ @deprecated("use `Array.tabulate' instead")
+ def fromFunction[T: ClassManifest](f: (Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int): Array[Array[Array[T]]] =
+ fromFunction(i => fromFunction(f(i, _, _))(n2, n3))(n1)
+
+ /** Create an array containing the values of a given function <code>f</code>
+ * over given range <code>[0..n1, 0..n2, 0..n3, 0..n4)</code>
+ */
+ @deprecated("use `Array.tabulate' instead")
+ def fromFunction[T: ClassManifest](f: (Int, Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int, n4: Int): Array[Array[Array[Array[T]]]] =
+ fromFunction(i => fromFunction(f(i, _, _, _))(n2, n3, n4))(n1)
+
+ /** Create an array containing the values of a given function <code>f</code>
+ * over given range <code>[0..n1, 0..n2, 0..n3, 0..n4, 0..n5)</code>
+ */
+ @deprecated("use `Array.tabulate' instead")
+ def fromFunction[T: ClassManifest](f: (Int, Int, Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int, n4: Int, n5: Int): Array[Array[Array[Array[Array[T]]]]] =
+ fromFunction(i => fromFunction(f(i, _, _, _, _))(n2, n3, n4, n5))(n1)
}
/** This class represents polymorphic arrays. <code>Array[T]</code> is Scala's representation