With the advent of TraversableOnce
and Iterator
, it can be useful to have a builder which
operates on Iterator
s so they can be treated uniformly along with the collections.
With the advent of TraversableOnce
and Iterator
, it can be useful to have a builder which
operates on Iterator
s so they can be treated uniformly along with the collections.
See scala.util.Random.shuffle
for an example.
Creates an iterator with given elements.
Creates an iterator with given elements.
The elements returned one-by-one from the iterator
An iterator which produces the given elements on the
first calls to next
, and which has no further elements.
Creates an infinite-length iterator returning the results of evaluating an expression.
Creates an infinite-length iterator returning the results of evaluating an expression. The expression is recomputed for every element.
the element computation.
the iterator containing an infinite number of results of evaluating elem
.
The iterator which produces no values.
Creates iterator that produces the results of some element computation a number of times.
Creates iterator that produces the results of some element computation a number of times.
the number of elements returned by the iterator.
the element computation
An iterator that produces the results of n
evaluations of elem
.
Creates an infinite-length iterator returning values equally spaced apart.
Creates an infinite-length iterator returning values equally spaced apart.
the start value of the iterator
the increment between successive values
the iterator producing the infinite sequence of values start, start + 1 * step, start + 2 * step, ...
Creates an infinite-length iterator which returns successive values from some start value.
Creates an infinite-length iterator which returns successive values from some start value.
the start value of the iterator
the iterator producing the infinite sequence of values start, start + 1, start + 2, ...
Creates an infinite iterator that repeatedly applies a given function to the previous result.
Creates an infinite iterator that repeatedly applies a given function to the previous result.
the start value of the iterator
the function that's repeatedly applied
the iterator producing the infinite sequence of values start, f(start), f(f(start)), ...
An iterator producing equally spaced values in some integer interval.
An iterator producing equally spaced values in some integer interval.
the start value of the iterator
the end value of the iterator (the first value NOT returned)
the increment value of the iterator (must be positive or negative)
the iterator producing values start, start + step, ...
up to, but excluding end
Creates nn iterator returning successive values in some integer interval.
Creates nn iterator returning successive values in some integer interval.
the start value of the iterator
the end value of the iterator (the first value NOT returned)
the iterator producing values start, start + 1, ..., end - 1
Creates an iterator which produces a single element.
Creates an iterator which produces a single element. Note: Equivalent, but more efficient than Iterator(elem)
the element
An iterator which produces elem
on the first call to next
,
and which has no further elements.
Creates an iterator producing the values of a given function over a range of integer values starting from 0.
Creates an iterator producing the values of a given function over a range of integer values starting from 0.
The number of elements returned by the iterator
The function computing element values
An iterator that produces the values f(0), ..., f(n -1)
.
The
Iterator
object provides various functions for creating specialized iterators.2.8
2.8