scala.xml.pull.ProducerConsumerIterator

GroupedIterator

class GroupedIterator[B >: A] extends Iterator[Seq[B]]

A flexible iterator for transforming an Iterator[A] into an Iterator[Seq[A]], with configurable sequence size, step, and strategy for dealing with elements which don't fit evenly.

Typical uses can be achieved via methods grouped' and sliding'.

definition classes: Iterator

Inherits

  1. Iterator
  2. AnyRef
  3. Any

Type Members

  1. class GroupedIterator[B >: A] extends Iterator[Seq[B]]

    A flexible iterator for transforming an Iterator[A] into an Iterator[Seq[A]], with configurable sequence size, step, and strategy for dealing with elements which don't fit evenly

Value Members

  1. def ++[B >: Seq[B]](that: ⇒ Iterator[B]): Iterator[B]

    Concatenates this iterator with another

  2. def /:[B](z: B)(op: (B, Seq[B]) ⇒ B): B

    Applies a binary operator to a start value and all values produced by this iterator, going left to right

  3. def :\[B](z: B)(op: (Seq[B], B) ⇒ B): B

    Applies a binary operator to all values produced by this iterator and a start value, going right to left

  4. def addString(buf: StringBuilder): StringBuilder

    Appends all values produced by this iterator to a string builder

  5. def addString(buf: StringBuilder, sep: String): StringBuilder

    Appends all values produced by this iterator to a string builder using a separator string

  6. def addString(buf: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Appends all values produced by this iterator to a string builder using start, end, and separator strings

  7. def append[B >: Seq[B]](that: Iterator[B]): Iterator[B]

    Returns a new iterator that first yields the elements of this iterator followed by the elements provided by iterator that

  8. def buffered: BufferedIterator[Seq[B]]

    Creates a buffered iterator from this iterator

  9. def collect: Seq[Seq[B]]

    Collect elements into a seq

  10. def contains(elem: Any): Boolean

    Tests whether this iterator contains a given value as an element

  11. def copyToArray[B >: Seq[B]](xs: Array[B]): Unit

    Copies values produced by this iterator to an array

  12. def copyToArray[B >: Seq[B]](xs: Array[B], start: Int): Unit

    Copies values produced by this iterator to an array

  13. def copyToArray[B >: Seq[B]](xs: Array[B], start: Int, len: Int): Unit

    Copies selected values produced by this iterator to an array

  14. def copyToBuffer[B >: Seq[B]](dest: Buffer[B]): Unit

    Copies all values produced by this iterator to a buffer

  15. def counted: CountedIterator[Seq[B]]

    Returns a counted iterator from this iterator

  16. def drop(n: Int): Iterator[Seq[B]]

    Advances this iterator past the first n elements, or the length of the iterator, whichever is smaller

  17. def dropWhile(p: (Seq[B]) ⇒ Boolean): Iterator[Seq[B]]

    Skips longest sequence of elements of this iterator which satisfy given predicate p, and returns an iterator of the remaining elements

  18. def duplicate: (Iterator[Seq[B]], Iterator[Seq[B]])

    Creates two new iterators that both iterate over the same elements as this iterator (in the same order)

  19. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

  20. def exists(p: (Seq[B]) ⇒ Boolean): Boolean

    Tests whether a predicate holds for some of the values produced by this iterator

  21. def filter(p: (Seq[B]) ⇒ Boolean): Iterator[Seq[B]]

    Returns an iterator over all the elements of this iterator that satisfy the predicate p

  22. def filterNot(p: (Seq[B]) ⇒ Boolean): Iterator[Seq[B]]

    Creates an iterator over all the elements of this iterator which do not satisfy a predicate p

  23. def find(p: (Seq[B]) ⇒ Boolean): Option[Seq[B]]

    Finds the first value produced by the iterator satisfying a predicate, if any

  24. def findIndexOf(p: (Seq[B]) ⇒ Boolean): Int

    Returns index of the first element satisfying a predicate, or -1

  25. def flatMap[B](f: (Seq[B]) ⇒ Iterator[B]): Iterator[B]

    Creates a new iterator by applying a function to all values produced by this iterator and concatenating the results

  26. def foldLeft[B](z: B)(op: (B, Seq[B]) ⇒ B): B

    Applies a binary operator to a start value and all values produced by this iterator, going left to right

  27. def foldRight[B](z: B)(op: (Seq[B], B) ⇒ B): B

    Applies a binary operator to all values produced by this iterator and a start value, going right to left

  28. def forall(p: (Seq[B]) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all values produced by this iterator

  29. def foreach[U](f: (Seq[B]) ⇒ U): Unit

    Applies a function f to all values produced by this iterator

  30. def grouped[B >: Seq[B]](size: Int): GroupedIterator[B]

    Returns an iterator which groups this iterator into fixed size blocks

  31. def hasNext: Boolean

    Tests whether this iterator can provide another element

  32. def hashCode(): Int

    Returns a hash code value for the object

  33. def indexOf[B >: Seq[B]](elem: B): Int

    Returns the index of the first occurence of the specified object in this iterable object

  34. def indexWhere(p: (Seq[B]) ⇒ Boolean): Int

    Returns the index of the first produced value satisfying a predicate, or -1

  35. def length: Int

    Returns the number of elements in this iterator

  36. def map[B](f: (Seq[B]) ⇒ B): Iterator[B]

    Creates a new iterator that maps all produced values of this iterator to new values using a transformation function

  37. def mkString: String

    Displays all values produced by this iterator in a string

  38. def mkString(sep: String): String

    Displays all values produced by this iterator in a string using a separator string

  39. def mkString(start: String, sep: String, end: String): String

    Displays all values produced by this iterator in a string using start, end, and separator strings

  40. def next(): List[B]

    Produces the next element of this iterator

  41. def padTo[A1 >: Seq[B]](len: Int, elem: A1): Iterator[A1]

    Appends an element value to this iterator until a given target length is reached

  42. def partialMap[B](pf: PartialFunction[Seq[B], B]): Iterator[B]

    Creates an iterator by transforming values produced by this iterator with a partial function, dropping those values for which the partial function is not defined

  43. def partition(p: (Seq[B]) ⇒ Boolean): (Iterator[Seq[B]], Iterator[Seq[B]])

    Partitions this iterator in two iterators according to a predicate

  44. def patch[B >: Seq[B]](from: Int, patchElems: Iterator[B], replaced: Int): Iterator[B]

    Returns this iterator with patched values

  45. def readInto[B >: Seq[B]](xs: Array[B]): Unit

  46. def readInto[B >: Seq[B]](xs: Array[B], start: Int): Unit

  47. def readInto[B >: Seq[B]](xs: Array[B], start: Int, sz: Int): Unit

    Fills the given array xs with the elements of this sequence starting at position start

  48. def reduceLeft[B >: Seq[B]](op: (B, Seq[B]) ⇒ B): B

    Applies a binary operator to all values produced by this iterator, going left to right

  49. def reduceLeftOption[B >: Seq[B]](op: (B, Seq[B]) ⇒ B): Option[B]

    Optionally applies a binary operator to all values produced by this iterator, going left to right

  50. def reduceRight[B >: Seq[B]](op: (Seq[B], B) ⇒ B): B

    Applies a binary operator to all values produced by this iterator, going right to left

  51. def reduceRightOption[B >: Seq[B]](op: (Seq[B], B) ⇒ B): Option[B]

    Optionally applies a binary operator to all values produced by this iterator, going right to left

  52. def sameElements(that: Iterator[_]): Boolean

    Tests if another iterator produces the same valeus as this one

  53. def slice(from: Int, until: Int): Iterator[Seq[B]]

    Creates an iterator returning an interval of the values produced by this iterator

  54. def sliding[B >: Seq[B]](size: Int, step: Int): GroupedIterator[B]

    Returns an iterator which presents a "sliding window" view of another iterator

  55. def take(n: Int): Iterator[Seq[B]]

    Selects first n values of this iterator

  56. def takeWhile(p: (Seq[B]) ⇒ Boolean): Iterator[Seq[B]]

    Takes longest prefix of values produced by this iterator that satisfy a predicate

  57. def toList: List[Seq[B]]

    Traverses this iterator and returns all produced values in a list

  58. def toSeq: Seq[Seq[B]]

    Traverses this iterator and returns all produced values in a sequence

  59. def toStream: Stream[Seq[B]]

    Traverses this iterator and returns all produced values in a list

  60. def toString(): String

    Converts this iterator to a string

  61. def withFilter(p: (Seq[B]) ⇒ Boolean): Iterator[Seq[B]]

    Creates an iterator over all the elements of this iterator that satisfy the predicate p

  62. def withPadding(x: ⇒ B): GroupedIterator[B]

    Public functions which can be used to configure the iterator before use

  63. def withPartial(x: Boolean): GroupedIterator[B]

  64. def zip[B](that: Iterator[B]): Iterator[(Seq[B], B)]

    Creates an iterator formed from this iterator and another iterator by combining corresponding values in pairs

  65. def zipAll[B, A1 >: Seq[B], B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1): Iterator[(A1, B1)]

    Creates an iterator formed from this iterator and another iterator by combining corresponding elements in pairs

  66. def zipWithIndex: Iterator[(Seq[B], Int)] {...}

    Creates an iterator that pairs each element produced by this iterator with its index, counting from 0

Instance constructors

  1. new GroupedIterator(self: Iterator[A], size: Int, step: Int)

  2. new GroupedIterator()