summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/PagedSeq.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/immutable/PagedSeq.scala')
-rw-r--r--src/library/scala/collection/immutable/PagedSeq.scala13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/library/scala/collection/immutable/PagedSeq.scala b/src/library/scala/collection/immutable/PagedSeq.scala
index 952107bf78..3a64820be6 100644
--- a/src/library/scala/collection/immutable/PagedSeq.scala
+++ b/src/library/scala/collection/immutable/PagedSeq.scala
@@ -8,7 +8,8 @@
-package scala.collection
+package scala
+package collection
package immutable
import java.io._
@@ -30,7 +31,7 @@ object PagedSeq {
new PagedSeq[T]((data: Array[T], start: Int, len: Int) => {
var i = 0
while (i < len && source.hasNext) {
- data(start + i) = source.next
+ data(start + i) = source.next()
i += 1
}
if (i == 0) -1 else i
@@ -51,7 +52,7 @@ object PagedSeq {
if (cnt == len) cnt
else (more(data, start + cnt, len - cnt) max 0) + cnt
} else if (source.hasNext) {
- current = source.next
+ current = source.next()
more(data, start, len)
} else -1
new PagedSeq(more(_: Array[Char], _: Int, _: Int))
@@ -125,6 +126,7 @@ import PagedSeq._
* @define mayNotTerminateInf
* @define willNotTerminateInf
*/
+@deprecatedInheritance("The implementation details of paged sequences make inheriting from them unwise.", "2.11.0")
class PagedSeq[T: ClassTag] protected(
more: (Array[T], Int, Int) => Int,
first1: Page[T],
@@ -186,7 +188,10 @@ extends scala.collection.AbstractSeq[T]
val s = start + _start
val e = if (_end == UndeterminedEnd) _end else start + _end
var f = first1
- while (f.end <= s && !f.isLast) f = f.next
+ while (f.end <= s && !f.isLast) {
+ if (f.next eq null) f.addMore(more)
+ f = f.next
+ }
new PagedSeq(more, f, s, e)
}