scala
trait BufferedIterator

[source: `scala/BufferedIterator.scala`]

`` `trait` BufferedIterator[+A]
  `extends` Iterator[A]

  Buffered iterators are iterators which allow to inspect the next element without discarding it.

Author
  Martin Odersky
Version
  1.0, 16/07/2003

Direct Known Subclasses:
  DefaultBufferedIterator, Range

Method Summary
`override def` | buffered : BufferedIterator[A] Returns a buffered iterator from this iterator.
`protected def` | defaultPeek : A element returned when no element left to iterate over; throws `NoSuchElementException` by default
`override def` | hasNext : Boolean Does this iterator provide another element?
`def` | head : A Checks what the next available element is.
`def` | peek (n : Int) : A return the `n`th element that will be iterated by this iterator
`abstract def` | peekList (sz : Int) : Seq[A] returns the first `sz` elements that will be iterated by this iterator, or fewer if the iterator has less elements left to iterate over
`def` | readIf [T](f : PartialFunction[A, T]) : Option[T] iterates over and applies `f` to the next element if this iterator has a next element that `f` is defined for.
`def` | readWhile (f : (A) => Boolean) : Seq[A] iterates over elements as long as `f` is true for each element, returns the elements iterated over
`def` | startsWith (seq : Seq[Any]) : Boolean true if elements of `seq` will be iterated over next in this iterator
`override def` | toString : String

Methods inherited from Iterator
next (abstract), 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

`abstract` `def` peekList(sz : Int) : Seq[A]

  returns the first `sz` elements that will be iterated by this iterator, or fewer if the iterator has less elements left to iterate over

`` `def` head : A

  Checks what the next available element is.

Returns
  the current element

`` `def` peek(n : Int) : A

  return the `n`th element that will be iterated by this iterator

`protected` `def` defaultPeek : A

  element returned when no element left to iterate over; throws `NoSuchElementException` by default

`` `def` readIf[T](f : PartialFunction[A, T]) : Option[T]

  iterates over and applies `f` to the next element if this iterator has a next element that `f` is defined for.

`` `def` readWhile(f : (A) => Boolean) : Seq[A]

  iterates over elements as long as `f` is true for each element, returns the elements iterated over

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

  true if elements of `seq` will be iterated over next in this iterator

`override` `def` buffered : BufferedIterator[A]

  Returns a buffered iterator from this iterator.

Overrides
  Iterator.buffered

`override` `def` hasNext : Boolean

  Does this iterator provide another element?

Overrides
  Iterator.hasNext

`override` `def` toString : String

Overrides
  Iterator.toString