diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-11-26 14:10:15 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-11-26 14:10:15 +0000 |
commit | 5ded3c7a61f3c76cf36410224f90eb70e793209e (patch) | |
tree | e5fb8306ed2d799a3296c2ea0da051e0fd75cb57 /src/library | |
parent | 8f5b0ef42808e15bbe8ff25d0dc494a4d1625948 (diff) | |
download | scala-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')
-rw-r--r-- | src/library/scala/collection/immutable/Vector.scala | 11 |
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()) } |