summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/UnrolledBuffer.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/mutable/UnrolledBuffer.scala')
-rw-r--r--src/library/scala/collection/mutable/UnrolledBuffer.scala17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/library/scala/collection/mutable/UnrolledBuffer.scala b/src/library/scala/collection/mutable/UnrolledBuffer.scala
index cd76c7de4e..6785aba10d 100644
--- a/src/library/scala/collection/mutable/UnrolledBuffer.scala
+++ b/src/library/scala/collection/mutable/UnrolledBuffer.scala
@@ -12,6 +12,7 @@ import collection.AbstractIterator
import collection.Iterator
import collection.generic._
import annotation.tailrec
+import reflect.ClassTag
/** A buffer that stores elements in an unrolled linked list.
*
@@ -41,11 +42,11 @@ import annotation.tailrec
*
*/
@SerialVersionUID(1L)
-class UnrolledBuffer[T](implicit val tag: ArrayTag[T])
+class UnrolledBuffer[T](implicit val tag: ClassTag[T])
extends collection.mutable.AbstractBuffer[T]
with collection.mutable.Buffer[T]
with collection.mutable.BufferLike[T, UnrolledBuffer[T]]
- with GenericArrayTagTraversableTemplate[T, UnrolledBuffer]
+ with GenericClassTagTraversableTemplate[T, UnrolledBuffer]
with collection.mutable.Builder[T, UnrolledBuffer[T]]
with Serializable
{
@@ -67,7 +68,7 @@ extends collection.mutable.AbstractBuffer[T]
private[collection] def calcNextLength(sz: Int) = sz
- def arrayTagCompanion = UnrolledBuffer
+ def classTagCompanion = UnrolledBuffer
/** Concatenates the targer unrolled buffer to this unrolled buffer.
*
@@ -179,15 +180,17 @@ extends collection.mutable.AbstractBuffer[T]
}
}
+ override def clone(): UnrolledBuffer[T] = new UnrolledBuffer[T] ++= this
+
override def stringPrefix = "UnrolledBuffer"
}
-object UnrolledBuffer extends ArrayTagTraversableFactory[UnrolledBuffer] {
+object UnrolledBuffer extends ClassTagTraversableFactory[UnrolledBuffer] {
/** $genericCanBuildFromInfo */
- implicit def canBuildFrom[T](implicit t: ArrayTag[T]): CanBuildFrom[Coll, T, UnrolledBuffer[T]] =
+ implicit def canBuildFrom[T](implicit t: ClassTag[T]): CanBuildFrom[Coll, T, UnrolledBuffer[T]] =
new GenericCanBuildFrom[T]
- def newBuilder[T](implicit t: ArrayTag[T]): Builder[T, UnrolledBuffer[T]] = new UnrolledBuffer[T]
+ def newBuilder[T](implicit t: ClassTag[T]): Builder[T, UnrolledBuffer[T]] = new UnrolledBuffer[T]
val waterline = 50
val waterlineDelim = 100
@@ -195,7 +198,7 @@ object UnrolledBuffer extends ArrayTagTraversableFactory[UnrolledBuffer] {
/** Unrolled buffer node.
*/
- class Unrolled[T: ArrayTag] private[collection] (var size: Int, var array: Array[T], var next: Unrolled[T], val buff: UnrolledBuffer[T] = null) {
+ class Unrolled[T: ClassTag] private[collection] (var size: Int, var array: Array[T], var next: Unrolled[T], val buff: UnrolledBuffer[T] = null) {
private[collection] def this() = this(0, new Array[T](unrolledlength), null, null)
private[collection] def this(b: UnrolledBuffer[T]) = this(0, new Array[T](unrolledlength), null, b)