scala/scala — pull request #3644 by retronym (2014-03-20 20:54:40+00:00)
Title: SI-8431 Fix regression in iterator concatenation

Regressed in e3ddb2d7, which introduced `ConcatIterator` to
avoid super-linear runtime on chains of concatenated iterators.

`ConcatIterator` maintains a queue of thunks for the remaining
iterators. Both `next` and `hasNext` delegate to `advance`, which
evaluates the thunks and discards any empty iterators from the
start of the queue. The first non-empty iterator is stored in
the var `current`.

It also overrides `++`, and creates a new `ConcatIterator` with
the given `that` as an extra element in the queue. However, it
failed to copy `current` across, which led to data loss.