summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/Vector.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-11-26 14:10:15 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-11-26 14:10:15 +0000
commit5ded3c7a61f3c76cf36410224f90eb70e793209e (patch)
treee5fb8306ed2d799a3296c2ea0da051e0fd75cb57 /src/library/scala/collection/immutable/Vector.scala
parent8f5b0ef42808e15bbe8ff25d0dc494a4d1625948 (diff)
downloadscala-5ded3c7a61f3c76cf36410224f90eb70e793209e.tar.gz
scala-5ded3c7a61f3c76cf36410224f90eb70e793209e.tar.bz2
scala-5ded3c7a61f3c76cf36410224f90eb70e793209e.zip
Changes to the vector class that will be needed...
Changes to the vector class that will be needed for ParVector. Review by Rompf.
Diffstat (limited to 'src/library/scala/collection/immutable/Vector.scala')
-rw-r--r--src/library/scala/collection/immutable/Vector.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index 9faab71158..3f1aa8c1b5 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -636,7 +636,16 @@ final class VectorIterator[+A](_startIndex: Int, _endIndex: Int) extends Iterato
res
}
- // TODO: drop (important?)
+ private[collection] def remainingElementCount: Int = (_endIndex - (blockIndex + lo)) max 0
+
+ /** Creates a new vector which consists of elements remaining in this iterator.
+ * Such a vector can then be split into several vectors using methods like `take` and `drop`.
+ */
+ private[collection] def remainingVector: Vector[A] = {
+ val v = new Vector(blockIndex + lo, _endIndex, blockIndex + lo)
+ v.initFrom(this)
+ v
+ }
@deprecated("this method is experimental and will be removed in a future release")
@inline def foreachFast[U](f: A => U) { while (hasNext) f(next()) }