Get the next item from the stream, advancing the cursor, while
honoring previous calls to pushback().
Get the next item from the stream, advancing the cursor, while
honoring previous calls to pushback().
an Option containing the next item, or None
if the iterator is exhausted.
Push a list of items back onto the stream.
Push a list of items back onto the stream. The items are pushed back in reverse order, so the items in the list should be in the order they were retrieved from the stream. For example:
val stream = new IteratorStream[Char]("foobar") with Pushback[Char] val list = List(stream.next.get, stream.next.get) // At this point, the list contains ('f', 'o'), and the stream // contains "obar". stream.pushback(list) // Stream now contains "foobar"
the items to push back.
Push a single item back onto the stream.
Push a single item back onto the stream.
the item
Get the count of the number of items consumed so far.
Get the count of the number of items consumed so far.
the count
The
Pushbacktrait can be mixed into anIteratorStreamto permit arbitrary pushback.