Interface for implementing BufferedIterators following a common pattern: the hasNext implementation must
actually compute the next element (or return a sentinel that implies that one doesn't exist), and should therefore
cache that element to serve head and next() calls.
This interface allows subclasses to simply implement an _advance method that returns an Option containing the
next element, if one exists, and None otherwise, and it takes care of the rest of the boilerplate.
It also exposes protected clear and postNext methods for Noneing the internal state and responding to
next() having been called, respectively.
Linear Supertypes
BufferedIterator[T], Iterator[T], TraversableOnce[T], GenTraversableOnce[T], AnyRef, Any
Interface for implementing BufferedIterators following a common pattern: the
hasNext
implementation must actually compute the next element (or return a sentinel that implies that one doesn't exist), and should therefore cache that element to servehead
andnext()
calls.This interface allows subclasses to simply implement an
_advance
method that returns an Option containing the next element, if one exists, and None otherwise, and it takes care of the rest of the boilerplate.It also exposes protected
clear
andpostNext
methods for Noneing the internal state and responding tonext()
having been called, respectively.