summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Osheim <d_m@plastic-idolatry.com>2012-03-25 21:04:58 -0400
committerErik Osheim <d_m@plastic-idolatry.com>2012-03-25 21:04:58 -0400
commit4b0d4571ecc8cfb1550c24a2cf11c8d0d535c36f (patch)
tree69a436f32290e81e09ca2bc3c3a1e4464dbf90f9
parenta532ba0600444b3564b6b015688ebc4cdf084ba6 (diff)
downloadscala-4b0d4571ecc8cfb1550c24a2cf11c8d0d535c36f.tar.gz
scala-4b0d4571ecc8cfb1550c24a2cf11c8d0d535c36f.tar.bz2
scala-4b0d4571ecc8cfb1550c24a2cf11c8d0d535c36f.zip
Fix .empty and add .ofDim factory method.
This commit removes the (unused and unnecessary) elems* parameter from the 'empty' method. It also adds 'ofDim' which allows the user to allocate a FlatArray of a given size without providing actual elements. This fixes SI-5609.
-rw-r--r--src/library/scala/collection/mutable/FlatArray.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/library/scala/collection/mutable/FlatArray.scala b/src/library/scala/collection/mutable/FlatArray.scala
index a7f994bf74..3e43b66ecf 100644
--- a/src/library/scala/collection/mutable/FlatArray.scala
+++ b/src/library/scala/collection/mutable/FlatArray.scala
@@ -60,8 +60,15 @@ extends AbstractSeq[T]
*/
object FlatArray {
- def empty[Boxed, Unboxed](elems: Boxed*)
- (implicit boxings: BoxingConversions[Boxed, Unboxed], elemManifest: ClassManifest[Unboxed]): FlatArray[Boxed] = apply()
+ def ofDim[Boxed, Unboxed](size:Int)
+ (implicit boxings: BoxingConversions[Boxed, Unboxed],
+ manifest: ClassManifest[Unboxed]): FlatArray[Boxed] = {
+ val elems = Array.ofDim[Unboxed](size)
+ new FlatArray.Impl(elems, boxings, manifest)
+ }
+
+ def empty[Boxed, Unboxed](implicit boxings: BoxingConversions[Boxed, Unboxed],
+ elemManifest: ClassManifest[Unboxed]): FlatArray[Boxed] = apply()
def apply[Boxed, Unboxed](elems: Boxed*)
(implicit boxings: BoxingConversions[Boxed, Unboxed], elemManifest: ClassManifest[Unboxed]): FlatArray[Boxed] = {