summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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()) }