in scala
trait Iterable

trait Iterable[+A]()
extends Object
with ScalaObject
Implementing classes or objects:
trait Option[+A]()
trait IterableProxy[+A]()
trait Seq[+A]()
trait Map[A,+B]() in scala/collection
trait Set[A]() in scala/collection
class History[A,B]() in scala/collection/mutable
class ResizableArray[A]() in scala/collection/mutable
class MetaData() in scala/xml

Collection classes supporting this trait provide a method elements which returns an iterator over all the elements contained in the collection.
Author:
Matthias Zenger
Version:
1.1, 04/02/2004

Method Summary
  def /:[B](z: B)(f: (B,A) => B): B
     Similar to foldLeft but can be used as an operator with the order of list and zero arguments reversed.
  def :\[B](z: B)(f: (A,B) => B): B
     An alias for foldRight.
  def concat[B >: A](that: Iterable[B]): Iterable[B]
     Concatenates two iterable objects
abstract def elements: Iterator[A]
     Creates a new iterator over all elements contained in this object.
  def exists(p: (A) => Boolean): 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 find(p: (A) => Boolean): Option[A]
     Find and return the first element of the iterable object satisfying a predicate, if any.
  def foldLeft[B](z: B)(op: (B,A) => B): 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: (A,B) => B): 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: (A) => Boolean): 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) => Unit): Unit
     Apply a function f to all elements of this iterable object.
  def sameElements[B >: A](that: Iterable[B]): Boolean
     Checks if the other iterable object contains the same elements.

Methods inherited from java/lang/Object-class
clone, eq, equals, finalize, getClass, hashCode, ne, notify, notifyAll, synchronized, toString, wait, wait, wait

Methods inherited from scala/Any-class
!=, ==, asInstanceOf, isInstanceOf, match

Methods inherited from scala/ScalaObject-class
getScalaType

Method Detail

elements

  abstract def elements: Iterator[A]
Creates a new iterator over all elements contained in this object.
Returns:
the new iterator

concat

  def concat[B >: A](that: Iterable[B]): Iterable[B]
Concatenates two iterable objects
Author:
buraq
Returns:
the new iterable object

foreach

  def foreach(f: (A) => Unit): Unit
Apply a function f to all elements of this iterable object.
Parameters:
f - a function that is applied to every element.

forall

  def forall(p: (A) => Boolean): Boolean
Apply a predicate p to all elements of this iterable object and return true, iff the predicate yields true for all elements.
Parameters:
p - the predicate
Returns:
true, iff the predicate yields true for all elements.

exists

  def exists(p: (A) => Boolean): 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.
Parameters:
p - the predicate
Returns:
true, iff the predicate yields true for at least one element.

find

  def find(p: (A) => Boolean): Option[A]
Find and return the first element of the iterable object satisfying a predicate, if any.
Parameters:
p - the predicate
Returns:
the first element in the iterable object satisfying p, or None if none exists.

foldLeft

  def foldLeft[B](z: B)(op: (B,A) => B): B
Combines the elements of this list together using the binary operator op, from left to right, and starting with the value z.
Returns:
op(... (op(op(z,a0),a1) ...), an) if the list is List(a0, a1, ..., an).

foldRight

  def foldRight[B](z: B)(op: (A,B) => B): B
Combines the elements of this list together using the binary operator op, from rigth to left, and starting with the value z.
Returns:
a0 op (... op (an op z)...) if the list is [a0, a1, ..., an].

/:

  def /:[B](z: B)(f: (B,A) => B): 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: (A,B) => B): B
An alias for foldRight. That is, xs :\ z is the same as xs foldRight z

sameElements

  def sameElements[B >: A](that: Iterable[B]): Boolean
Checks if the other iterable object contains the same elements.
Parameters:
that - the other iterable object
Returns:
true, iff both iterable objects contain the same elements.