|
Scala 2.3.2
|
abstract
trait
Iterator
[A]
extends
java.lang.Object
with
scala.ScalaObject
hasNext
method for checking
if there is a next element available, and a next
method
which returns the next element and discards it from the iterator.Def Summary | |
def
++
[B >: A]
(that: scala.Iterator[B])
: java.lang.Object with scala.Iterator[B]
Returns a new iterator that first yields the elements of this iterator followed by the elements provided by iterator that .
|
|
def
/:
[B]
(z: B)(op: (B, A) => B)
: B
Similar to foldLeft but can be used as
an operator with the order of iterator and zero arguments reversed.
That is, z /: xs is the same as xs foldLeft z .
|
|
def
:\
[B]
(z: B)(op: (A, B) => B)
: B
An alias for foldRight .
That is, xs :\ z is the same as xs foldRight z .
|
|
def
append
[B >: A]
(that: scala.Iterator[B])
: java.lang.Object with scala.Iterator[B]
Returns a new iterator that first yields the elements of this iterator followed by the elements provided by iterator that .
|
|
def
buffered
: scala.BufferedIterator[A]
Returns a buffered iterator from this iterator. |
|
def
contains
(elem: scala.Any)
: scala.Boolean
Tests if the given value elem is a member of this iterator.
|
|
def
copyToArray
[B >: A]
(xs: scala.Array[B], start: scala.Int)
: scala.Unit
Fills the given array xs with the elements of
this sequence starting at position start .
|
|
def
copyToBuffer
[B >: A]
(dest: scala.collection.mutable.Buffer[B])
: scala.Unit
Copy all elements to a buffer |
|
def
counted
: java.lang.Object with scala.CountedIterator[A]
Returns a counted iterator from this iterator. |
|
def
drop
(n: scala.Int)
: scala.Iterator[A]
Removes the first n elements from this iterator.
|
|
def
dropWhile
(p: (A) => scala.Boolean)
: scala.Iterator[A]
Skips longest sequence of elements of this iterator which satisfy given predicate p , and returns an iterator of the remaining elements.
|
|
def
duplicate
: scala.Tuple2[scala.Iterator[A], scala.Iterator[A]]
Creates two new iterators that both iterate over the same elements than this iterator (in the same order). |
|
def
exists
(p: (A) => scala.Boolean)
: scala.Boolean
Apply a predicate p to all elements of this
iterable object and return true, iff there is at least one
element for which p yields true .
|
|
def
filter
(p: (A) => scala.Boolean)
: scala.Iterator[A]
Returns an iterator over all the elements of this iterator that satisfy the predicate p . The order of the elements
is preserved.
|
|
def
find
(p: (A) => scala.Boolean)
: scala.Option[A]
Find and return the first element of the iterable object satisfying a predicate, if any. |
|
def
flatMap
[B]
(f: (A) => scala.Iterator[B])
: scala.Iterator[B]
Applies the given function f to each element of
this iterator, then concatenates the results.
|
|
def
foldLeft
[B]
(z: B)(op: (B, A) => B)
: B
Combines the elements of this iterator together using the binary operator op , from left to right, and starting with
the value z .
|
|
def
foldRight
[B]
(z: B)(op: (A, B) => B)
: B
Combines the elements of this iterator together using the binary operator op , from right to left, and starting with
the value z .
|
|
def
forall
(p: (A) => scala.Boolean)
: scala.Boolean
Apply a predicate p to all elements of this
iterable object and return true iff the predicate yields
true for all elements.
|
|
def
foreach
(f: (A) => scala.Unit)
: scala.Unit
Apply a function f to all elements of this
iterable object.
|
|
abstract
|
def
hasNext
: scala.Boolean
Does this iterator provide another element? |
def
map
[B]
(f: (A) => B)
: scala.Iterator[B]
Returns a new iterator that maps all elements of this iterator to new elements using function f .
|
|
abstract
|
def
next
: A
Returns the next element. |
def
reduceLeft
[B >: A]
(op: (B, B) => B)
: B
Combines the elements of this iterator together using the binary operator op , from left to right
|
|
def
reduceRight
[B >: A]
(op: (B, B) => B)
: B
Combines the elements of this iterator together using the binary operator op , from right to left
|
|
def
take
(n: scala.Int)
: java.lang.Object with scala.Iterator[A]
Returns a new iterator that iterates only over the first n
elements.
|
|
def
takeWhile
(p: (A) => scala.Boolean)
: scala.Iterator[A]
Returns an iterator over the longest prefix of this iterator such that all elements of the result satisfy the predicate p .
The order of the elements is preserved.
|
|
def
toList
: scala.List[A]
Transform this iterator into a list of all elements. |
|
def
zip
[B]
(that: scala.Iterator[B])
: java.lang.Object with scala.Iterator[{A, B}]
Return an iterator formed from this iterator and the specified iterator that by associating each element of the former with
the element at the same position in the latter.
If one of the two iterators is longer than the other, its remaining elements are ignored.
|
|
def
zipWithIndex
: java.lang.Object with scala.Iterator[{A, scala.Int}]
Return an iterator that pairs each element of this iterator with its index, counting from 0. |
Def Detail |
def
++
[B >: A](that: scala.Iterator[B]): java.lang.Object with scala.Iterator[B]
that
.foldLeft
but can be used as
an operator with the order of iterator and zero arguments reversed.
That is, z /: xs
is the same as xs foldLeft z
.z -
the left argument of the first application of op
(evaluation occurs from left to right).
op -
the applied operator.
foldLeft
.
foldRight
.
That is, xs :\ z
is the same as xs foldRight z
.z -
the right argument of the first application of op
(evaluation occurs from right to left).
op -
the applied operator.
foldRight
.
def
append
[B >: A](that: scala.Iterator[B]): java.lang.Object with scala.Iterator[B]
that
.++
def
buffered
: scala.BufferedIterator[A]
def
contains
(elem: scala.Any): scala.Boolean
elem
is a member of this iterator.elem -
element whose membership has to be tested.
true
iff there is an element of this iterator which is equal (w.r.t. ==
) to elem
.
def
copyToArray
[B >: A](xs: scala.Array[B], start: scala.Int): scala.Unit
xs
with the elements of
this sequence starting at position start
.xs -
the array to fill.
start -
the starting index.
def
copyToBuffer
[B >: A](dest: scala.collection.mutable.Buffer[B]): scala.Unit
The -
buffer to which elements are copied
def
counted
: java.lang.Object with scala.CountedIterator[A]
def
drop
(n: scala.Int): scala.Iterator[A]
n
elements from this iterator.n -
the number of elements to drop
def
dropWhile
(p: (A) => scala.Boolean): scala.Iterator[A]
p
, and returns an iterator of the remaining elements.p -
the predicate used to skip elements.
def
duplicate
: scala.Tuple2[scala.Iterator[A], scala.Iterator[A]]
def
exists
(p: (A) => scala.Boolean): scala.Boolean
p
to all elements of this
iterable object and return true, iff there is at least one
element for which p
yields true
.p -
the predicate
true
iff the predicate yields true
for at least one element.
def
filter
(p: (A) => scala.Boolean): scala.Iterator[A]
p
. The order of the elements
is preserved.p -
the predicate used to filter the iterator.
p
.
def
find
(p: (A) => scala.Boolean): scala.Option[A]
p -
the predicate
p
, or None
if none exists.
def
flatMap
[B](f: (A) => scala.Iterator[B]): scala.Iterator[B]
f
to each element of
this iterator, then concatenates the results.f -
the function to apply on each element.
f(a0), ... , f(an)
if this iterator yields the
elements a0, ..., an
.
op
, from left to right, and starting with
the value z
.op(... (op(op(z,a0),a1) ...), an)
if the iterator yields elements
a0, a1, ..., an
.
op
, from right to left, and starting with
the value z
.a0 op (... op (an op z)...)
if the iterator yields elements a0, a1, ...,
an
.
def
forall
(p: (A) => scala.Boolean): scala.Boolean
p
to all elements of this
iterable object and return true
iff the predicate yields
true
for all elements.p -
the predicate
true
iff the predicate yields true
for all elements.
def
foreach
(f: (A) => scala.Unit): scala.Unit
f
to all elements of this
iterable object.f -
a function that is applied to every element.
abstract
def
hasNext
: scala.Boolean
def
map
[B](f: (A) => B): scala.Iterator[B]
f
.
abstract
def
next
: A
op
, from left to rightop -
The operator to apply
op(... op(a0,a1), ..., an)
if the iterator yields elements
a0, a1, ..., an
.
Predef.UnsupportedOperationException -
if the iterator is empty.
op
, from right to leftop -
The operator to apply
a0 op (... op (an-1 op an)...)
if the iterator yields elements a0, a1, ...,
an
.
Predef.UnsupportedOperationException -
if the iterator is empty.
def
take
(n: scala.Int): java.lang.Object with scala.Iterator[A]
n
elements.n -
the number of elements to take
def
takeWhile
(p: (A) => scala.Boolean): scala.Iterator[A]
p
.
The order of the elements is preserved.p -
the predicate used to filter the iterator.
p
.
def
toList
: scala.List[A]
def
zip
[B](that: scala.Iterator[B]): java.lang.Object with scala.Iterator[{A, B}]
that
by associating each element of the former with
the element at the same position in the latter.
If one of the two iterators is longer than the other, its remaining elements are ignored.{a0,b0}, {a1,b1}, ...
where
ai
are the elements from this iterator
and bi
are the elements from iterator
that
.
def
zipWithIndex
: java.lang.Object with scala.Iterator[{A, scala.Int}]
start -
the index of the first element.
{a0,0}, {a1,1}...
where ai
are the elements from this iterator.