scala.collection

class RollbackIterator

[source: scala/collection/RollbackIterator.scala]

class RollbackIterator[+A](underlying : Iterator[A])
extends Default[A]
Rollback iterators are buffered iterators which allow for unbounded rollbacks
Author
Sean McDirmid
Method Summary
protected def fill (sz : Int) : Seq[A]
used to fill lookahead buffer. sz can be used by implementations as a heauristic to determine how many elements are desired
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
override 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 Default
putBack, defaultPeek, hasNext, peekList
Methods inherited from PutBack
counted, flushFrom
Methods inherited from Advanced
head, peek, startsWith, toString, advanced
Methods inherited from BufferedIterator
headOpt, buffered, readIf, readWhile
Methods inherited from Iterator
take, drop, slice, map, append, ++, flatMap, filter, takeWhile, dropWhile, zip, zipWithIndex, foreach, forall, exists, contains, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, duplicate, copyToArray, readInto, readInto, readInto, copyToBuffer, toList, collect, mkString, 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(sz : Int) : Seq[A]
used to fill lookahead buffer. sz can be used by implementations as a heauristic to determine how many elements are desired
Overrides
Default.fill

override def next : A
Returns the next element.
Overrides
Default.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

override 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