scala

object Iterator

[source: scala/Iterator.scala]

object Iterator
extends AnyRef
The Iterator object provides various functions for creating specialized iterators.
Author
Martin Odersky
Matthias Zenger
Version
1.2, 10/02/2007
Value Summary
val empty : Iterator[Nothing]
Method Summary
def from (start : Int, step : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + step where e0 = start.
def from (start : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + 1 where e0 = start.
def from (start : Int, step : (Int) => Int) : Iterator[Int]
Create an iterator with elements en+1 = step(en) where e0 = start.
def fromArray [a](xs : Array[a], start : Int, length : Int) : Iterator[a]
def fromArray [a](xs : Array[a]) : Iterator[a]
def fromCaseClass (n : Product) : Iterator[Any]
def fromProduct (n : Product) : Iterator[Any]
def fromString (str : java.lang.String) : Iterator[Char]
def fromValues [a](xs : a*) : Iterator[a]
def range (start : Int, end : Int, step : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + step where e0 = start and elements are in the range between start (inclusive) and end (exclusive)
def range (start : Int, end : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + 1 where e0 = start and ei < end. However, if start ≥ end, then it will return an empty range.
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 single [a](x : a) : Iterator[a]
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
val empty : Iterator[Nothing]

Method Details
def single[a](x : a) : Iterator[a]
Parameters
x - the element
Returns
the iterator with one single element

def fromValues[a](xs : a*) : Iterator[a]

def fromArray[a](xs : Array[a]) : Iterator[a]
Parameters
xs - the array of elements
See Also
also: RandomAccessSeq.elements and slice

@throws(classOf[java.util.NoSuchElementException])

def fromArray[a](xs : Array[a], start : Int, length : Int) : Iterator[a]
Parameters
xs - the array of elements
start - the start index
length - the length
See Also
also: RandomAccessSeq.elements and slice

@deprecated

def fromString(str : java.lang.String) : Iterator[Char]
Parameters
str - the given string
Returns
the iterator on str
Deprecated
replaced by str.elements

def fromProduct(n : Product) : Iterator[Any]
Parameters
n - the product arity
Returns
the iterator on Product<n>.

@deprecated

def fromCaseClass(n : Product) : Iterator[Any]
Deprecated
use fromProduct instead.

def range(start : Int, end : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + 1 where e0 = start and ei < end. However, if start ≥ end, then it will return an empty range.
Parameters
start - the start value of the iterator
end - the end value of the iterator
Returns
the iterator with values in range [start;end).

@throws(classOf[java.util.NoSuchElementException])

def range(start : Int, end : Int, step : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + step where e0 = start and elements are in the range between start (inclusive) and end (exclusive)
Parameters
start - the start value of the iterator
end - the end value of the iterator
step - the increment value of the iterator (must be positive or negative)
Returns
the iterator with values in range [start;end).

@throws(classOf[java.util.NoSuchElementException])

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)
Parameters
start - the start value of the iterator
end - the end value of the iterator
step - the increment function of the iterator, must be monotonically increasing or decreasing
Returns
the iterator with values in range [start;end).

def from(start : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + 1 where e0 = start.
Parameters
start - the start value of the iterator
Returns
the iterator starting at value start.

def from(start : Int, step : Int) : Iterator[Int]
Create an iterator with elements en+1 = en + step where e0 = start.
Parameters
start - the start value of the iterator
step - the increment value of the iterator
Returns
the iterator starting at value start.

def from(start : Int, step : (Int) => Int) : Iterator[Int]
Create an iterator with elements en+1 = step(en) where e0 = start.
Parameters
start - the start value of the iterator
step - the increment function of the iterator
Returns
the iterator starting at value start.