scala.collection
class RollbackIterator

[source: `scala/collection/RollbackIterator.scala`]

`` `class` RollbackIterator[+A](underlying : Iterator[A])
  `extends` DefaultBufferedIterator[A]

  Rollback iterators are buffered iterators which allow for unbounded rollbacks

Author
  Sean McDirmid

Method Summary
`protected def` | fill : Seq[A] used to fill lookahead buffer
`override def` | next : A Returns the next element.
`def` | read (f : => Unit) : Boolean returns true if any elements are iterated over during `f`'s execution
`def` | readIfStartsWith (seq : Seq[Any]) : Boolean if elements of `seq` will be iterated over next in this iterator, returns true and iterates over these elements
`def` | remember [T](g : => (Seq[A]) => T) : T remembers elements iterated over during `g`'s execution and provides these elements to the result of `g`'s execution
`def` | tryRead [T](f : => Option[T]) : Option[T] will rollback all elements iterated during `f`'s execution if `f` return false

Methods inherited from DefaultBufferedIterator
putBack, defaultPeek, hasNext, peekList

Methods inherited from BufferedIterator
head, peek, readIf, readWhile, startsWith, buffered, toString

Methods inherited from Iterator
take, drop, map, append, ++, flatMap, filter, takeWhile, dropWhile, zip, zipWithIndex, foreach, forall, exists, contains, find, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, counted, duplicate, copyToArray, readInto, readInto, readInto, copyToBuffer, toList, mkString, mkString, addString

Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Method Details

`protected` `def` fill : Seq[A]

  used to fill lookahead buffer

Overrides
  DefaultBufferedIterator.fill

`override` `def` next : A

  Returns the next element.

Overrides
  DefaultBufferedIterator.next

`` `def` tryRead[T](f : => Option[T]) : Option[T]

  will rollback all elements iterated during `f`'s execution if `f` return false

`` `def` remember[T](g : => (Seq[A]) => T) : T

  remembers elements iterated over during `g`'s execution and provides these elements to the result of `g`'s execution

`` `def` read(f : => Unit) : Boolean

  returns true if any elements are iterated over during `f`'s execution

`` `def` readIfStartsWith(seq : Seq[Any]) : Boolean

  if elements of `seq` will be iterated over next in this iterator, returns true and iterates over these elements