|
Scala 2
|
||
class
Iterator
[ A ]
extends
java.lang.Object with
ScalaObjecthasNext
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& ]
( z : B& ) ( f : Function2 )
: B&
Similar to foldLeft but can be used as
an operator with the order of list and zero arguments reversed.
That is, z /: xs is the same as xs foldLeft z
|
|
def
:\
[ B& ]
( z : B& ) ( f : Function2 )
: B&
An alias for foldRight .
That is, xs :\ z is the same as xs foldRight z
|
|
def
append
[ A <: B& ]
( that : Iterator )
: <refinement>
Returns a new iterator that first yields the elements of this iterator followed by the elements provided by iterator that .
|
|
def
buffered
: BufferedIterator
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 list.
|
|
def
copyToArray
[ A <: B& ]
( xs : Array , start : scala.Int )
: Array
Fills the given array xs with the elements of
this sequence starting at position start .
|
|
def
counted
: <refinement>
Returns a counted iterator from this iterator. |
|
def
drop
( n : scala.Int )
: Iterator
Removes the first n elements from this iterator.
|
|
def
duplicate
: Tuple2
Creates two new iterators that both iterate over the same elements than this iterator (in the same order). |
|
def
exists
( p : Function1 )
: 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 : Function1 )
: BufferedIterator
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 : Function1 )
: Option
Find and return the first element of the iterable object satisfying a predicate, if any. |
|
def
flatMap
[ B& ]
( f : Function1 )
: Iterator
Applies the given function f to each element of
this iterator, then concatenates the results.
|
|
def
foldLeft
[ B& ]
( z : B& ) ( op : Function2 )
: B&
Combines the elements of this list together using the binary operator op , from left to right, and starting with
the value z .
|
|
def
foldRight
[ B& ]
( z : B& ) ( op : Function2 )
: B&
Combines the elements of this list together using the binary operator op , from rigth to left, and starting with
the value z .
|
|
def
forall
( p : Function1 )
: 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 : Function1 )
: scala.Unit
Apply a function f to all elements of this
iterable object.
|
|
def
hasNext
: scala.Boolean
Does this iterator provide another element? |
|
def
map
[ B& ]
( f : Function1 )
: Iterator
Returns a new iterator that maps all elements of this iterator to new elements using function f .
|
|
def
next
: A
Returns the next element. |
|
def
take
( n : scala.Int )
: <refinement>
Returns a new iterator that iterates only over the first n
elements.
|
|
def
toList
: List
Transform this iterator into a list of all elements. |
|
def
zip
[ B& ]
( that : Iterator )
: <refinement>
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.
|
Def Detail |
def
/:
[ B& ]( z : B& ) ( f : Function2 ) : B&
foldLeft
but can be used as
an operator with the order of list and zero arguments reversed.
That is, z /: xs
is the same as xs foldLeft z
def
:\
[ B& ]( z : B& ) ( f : Function2 ) : B&
foldRight
.
That is, xs :\ z
is the same as xs foldRight z
def
append
[ A <: B& ]( that : Iterator ) : <refinement>
that
.def
buffered
: BufferedIterator
def
contains
( elem : scala.Any ) : scala.Boolean
elem
is a member of this list.==
) to elem
.def
copyToArray
[ A <: B& ]( xs : Array , start : scala.Int ) : Array
xs
with the elements of
this sequence starting at position start
.xs
filled with this list.def
counted
: <refinement>
def
drop
( n : scala.Int ) : Iterator
n
elements from this iterator.def
duplicate
: Tuple2
def
exists
( p : Function1 ) : 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.def
filter
( p : Function1 ) : BufferedIterator
p
. The order of the elements
is preserved.p
.def
find
( p : Function1 ) : Option
p
,
or None
if none exists.def
flatMap
[ B& ]( f : Function1 ) : Iterator
f
to each element of
this iterator, then concatenates the results.f(a0), ... , f(an)
if this iterator
yields the elements a0, ..., an
.def
foldLeft
[ B& ]( z : B& ) ( op : Function2 ) : B&
op
, from left to right, and starting with
the value z
.op(... (op(op(z,a0),a1) ...), an)
if the list
is List(a0, a1, ..., an)
.def
foldRight
[ B& ]( z : B& ) ( op : Function2 ) : B&
op
, from rigth to left, and starting with
the value z
.a0 op (... op (an op z)...)
if the list
is [a0, a1, ..., an]
.def
forall
( p : Function1 ) : scala.Boolean
p
to all elements of this
iterable object and return true, iff the predicate yields
true for all elements.def
foreach
( f : Function1 ) : scala.Unit
f
to all elements of this
iterable object.def
hasNext
: scala.Boolean
def
map
[ B& ]( f : Function1 ) : Iterator
f
.def
next
: A
def
take
( n : scala.Int ) : <refinement>
n
elements.def
toList
: List
def
zip
[ B& ]( that : Iterator ) : <refinement>
that
by associating each element of the former with
the element at the same position in the latter.that
must have the same number of elements as this
iterator.(a0,b0), ..., (an,bn)
where
ai
are the elements from this iterator and
bi
are the elements from iterator that
.