|
Scala Library
|
|
scala/collection/Iterator.scala]
object
Iterator
extends AnyRefIterator object provides various functions for
creating specialized iterators.| Value Summary | |
val
|
empty : Iterator[Nothing] |
| Method Summary | |
def
|
apply
[A](elems : A*) : Iterator[A]
Creates an iterator with given elements
|
def
|
concat
[A](xss : Iterator[A]*) : Iterator[A]
Concatenates the given argument iterators into a single iterator.
|
def
|
continually
[A](elem : => A) : Iterator[A]
Create an infinite iterator based on the given expression
(which is recomputed for every element)
|
def
|
fill
[A](len : Int)(elem : => A) : Iterator[A]
An iterator that returns the results of some element computation a number of times.
|
def
|
flatten
[T](its : Iterator[Iterator[T]]) : Iterator[T]
Create an iterator that is the concantenation of all iterators
returned by a given iterator of iterators.
|
def
|
from
(start : Int, step : (Int) => Int) : Iterator[Int]
Create an iterator with elements
en+1 = step(en)
where e0 = start. |
def
|
from
(start : Int, step : Int) : Iterator[Int]
An infinite-length iterator returning values equally spaced apart.
|
def
|
from
(start : Int) : Iterator[Int]
An infinite-length iterator which returns successive values from some start value.
|
def
|
fromArray [a](xs : Array[a]) : Iterator[a] |
def
|
fromArray [a](xs : Array[a], start : Int, length : Int) : Iterator[a] |
def
|
fromProduct (n : Product) : Iterator[Any] |
def
|
fromValues [a](xs : a*) : Iterator[a] |
def
|
iterate
[T](start : T)(f : (T) => T) : Iterator[T]
An infinite iterator that repeatedly applies a given function to the previous result.
|
implicit def
|
iteratorIteratorWrapper
[A](its : Iterator[Iterator[A]]) : IteratorIteratorOps[A]
An implicit conversion which adds the `flatten` method to class `Iterator`
|
def
|
range
(start : Int, end : Int) : Iterator[Int]
An iterator returning successive values in some integer interval.
|
def
|
range
(start : Int, end : Int, step : (Int) => Int) : Iterator[Int]
Create an iterator with elements
en+1 = step(en)
where e0 = start
and elements are in the range between start (inclusive)
and end (exclusive) |
def
|
range
(start : Int, end : Int, step : Int) : Iterator[Int]
An iterator returning equally spaced values in some integer interval.
|
def
|
single
[A](elem : A) : Iterator[A]
An iterator with a single element.
|
def
|
tabulate
[A](end : Int)(f : (Int) => A) : Iterator[A]
An iterator that returns values of a given function over a range of
integer values starting from 0.
|
| Methods inherited from AnyRef | |
| getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Class Summary | |
class
|
IteratorIteratorOps
[A](its : Iterator[Iterator[A]]) extends AnyRef
A wrapper class for the
flatten method that is added to
class Iterator with implicit conversion |
| Value Details |
| Method Details |
elem - the elementelems - The elements returned one-by-one from the iterator
def
concat[A](xss : Iterator[A]*) : Iterator[A]
its - the argument iterators that are to be concatenatedlen - The number of elements returnedelem - The element computation determinining each resultend - The argument up to which values are tabulated.f - The function computing the resultsstart - the start value of the iteratorend - the end value of the iterator (the first value NOT returned)start - the start value of the iteratorend - the end value of the iterator (the first value NOT returned)step - the increment value of the iterator (must be positive or negative)start - the start value of the iteratorf - the function that's repeatedly appliedstart - the start value of the iteratorstart - the start value of the iteratorstep - the increment between successive valueselem - the element composing the resulting iteratorimplicit
def
iteratorIteratorWrapper[A](its : Iterator[Iterator[A]]) : IteratorIteratorOps[A]
def
fromValues[a](xs : a*) : Iterator[a]
def
fromArray[a](xs : Array[a]) : Iterator[a]
xs - the array of elements
def
fromArray[a](xs : Array[a], start : Int, length : Int) : Iterator[a]
xs - the array of elementsstart - the start indexlength - the length
def
fromProduct(n : Product) : Iterator[Any]
n - the product arityProduct<n>.
def
range(start : Int, end : Int, step : (Int) => Int) : Iterator[Int]
en+1 = step(en)
where e0 = start
and elements are in the range between start (inclusive)
and end (exclusive)start - the start value of the iteratorend - the end value of the iteratorstep - the increment function of the iterator, must be monotonically increasing or decreasing[start;end).
def
from(start : Int, step : (Int) => Int) : Iterator[Int]
en+1 = step(en)
where e0 = start.start - the start value of the iteratorstep - the increment function of the iteratorstart.its - The iterator which returns on each call to next a new iterator whose elements are to be concatenated to the result.|
Scala Library
|
|