in scala
trait Iterable

`abstract trait` Iterable [+A]
  `extends` java.lang.Object
  `with` scala.ScalaObject

  Collection classes mixing in this class 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

Direct Known Subclasses:
  MetaData, History, MutableIterable, Set, Map, Seq, IterableProxy, Relation

Def Summary
| `def` ++ [B >: A] (that: scala.Iterable[B]) : scala.Iterable[B] Appends two iterable objects.
| `def` /: [B] (z: B)(op: (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)(op: (A, B) => B) : B An alias for `foldRight`. That is, `xs :\ z` is the same as `xs foldRight z`
| `def` addString (buf: scala.compat.StringBuilder, start: java.lang.String, sep: java.lang.String, end: java.lang.String) : scala.compat.StringBuilder Write all elements of this string into given string builder
| `def` concat [B >: A] (that: scala.Iterable[B]) : scala.Iterable[B] Appends two iterable objects.
| `def` copyToBuffer [B >: A] (dest: scala.collection.mutable.Buffer[B]) : scala.Unit Copy all elements to a given buffer
| `def` drop (n: scala.Int) : scala.Iterable[A] Returns this iterable without its `n` first elements If this iterable has less than `n` elements, the empty iterable is returned.
| `def` dropWhile (p: (A) => scala.Boolean) : scala.Iterable[A] Returns the longest suffix of this iterable whose first element does not satisfy the predicate `p`.
`abstract` | `def` elements : scala.Iterator[A] Creates a new iterator over all elements contained in this object.
| `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.Iterable[A] Returns all the elements of this iterable 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` findIndexOf (p: (A) => scala.Boolean) : scala.Int Returns index of the first element satisying a predicate, or -1.
| `def` flatMap [B] (f: (A) => scala.Iterable[B]) : scala.Iterable[B] Applies the given function `f` to each element of this iterable, then concatenates the results.
| `def` foldLeft [B] (z: B)(op: (B, A) => B) : B Combines the elements of this iterable object together using the binary function `f`, 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 function `f`, 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.
| `def` indexOf [B >: A] (elem: B) : scala.Int Returns the index of the first occurence of the specified object in this iterable object.
| `def` map [B] (f: (A) => B) : scala.Iterable[B] Returns the iterable resulting from applying the given function `f` to each element of this iterable.
| `def` mkString (sep: java.lang.String) : java.lang.String Returns a string representation of this iterable object. The string representations of elements (w.r.t. the method `toString()`) are separated by the string `sep`.
| `def` mkString (start: java.lang.String, sep: java.lang.String, end: java.lang.String) : java.lang.String Returns a string representation of this iterable object. The resulting string begins with the string `start` and is finished by the string `end`. Inside, the string representations of elements (w.r.t. the method `toString()`) are separated by the string `sep`. Ex: `List(1, 2, 3).mkString("(", "; ", ")") = "(1; 2; 3)"`
| `def` reduceLeft [B >: A] (op: (B, B) => B) : B Combines the elements of this iterable object together using the binary operator `op`, from left to right
| `def` reduceRight [B >: A] (op: (B, B) => B) : B Combines the elements of this iterable object together using the binary operator `op`, from right to left
| `def` sameElements [B >: A] (that: scala.Iterable[B]) : scala.Boolean Checks if the other iterable object contains the same elements.
| `def` take (n: scala.Int) : scala.Iterable[A] Returns an iterable consisting only over the first `n` elements of this iterable, or else the whole iterable, if it has less than `n` elements.
| `def` takeWhile (p: (A) => scala.Boolean) : scala.Iterable[A] Returns the longest prefix of this iterable whose elements satisfy the predicate `p`.
| `def` toList : scala.List[A]

Def Detail

`def` ++ [B >: A](that: scala.Iterable[B]): scala.Iterable[B]

  Appends two iterable objects.

Returns:
  the new iterable object

`def` /: [B](z: B)(op: (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)(op: (A, B) => B): B

  An alias for `foldRight`. That is, `xs :\ z` is the same as `xs foldRight z`

`def` addString (buf: scala.compat.StringBuilder, start: java.lang.String, sep: java.lang.String, end: java.lang.String): scala.compat.StringBuilder

  Write all elements of this string into given string builder

[scala.deprecated]
`def` concat [B >: A](that: scala.Iterable[B]): scala.Iterable[B]

  Appends two iterable objects.

Returns:
  the new iterable object
Deprecated:
  use `++` instead

`def` copyToBuffer [B >: A](dest: scala.collection.mutable.Buffer[B]): scala.Unit

  Copy all elements to a given buffer

Parameters:
  `dest -` The buffer to which elements are copied

`def` drop (n: scala.Int): scala.Iterable[A]

  Returns this iterable without its `n` first elements If this iterable has less than `n` elements, the empty iterable is returned.

Parameters:
  `n -` the number of elements to drop
Returns:
  the new iterable

`def` dropWhile (p: (A) => scala.Boolean): scala.Iterable[A]

  Returns the longest suffix of this iterable whose first element does not satisfy the predicate `p`.

Parameters:
  `p -` the test predicate.
Returns:
  the longest suffix of the iterable whose first element does not satisfy the predicate `p`.

`abstract def` elements : scala.Iterator[A]

  Creates a new iterator over all elements contained in this object.

Returns:
  the new iterator

`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.

Parameters:
  `p -` the predicate
Returns:
  true, iff the predicate yields true for at least one element.

`def` filter (p: (A) => scala.Boolean): scala.Iterable[A]

  Returns all the elements of this iterable that satisfy the predicate `p`. The order of the elements is preserved.

Parameters:
  `p -` the predicate used to filter the list.
Returns:
  the elements of this list satisfying `p`.

`def` find (p: (A) => scala.Boolean): scala.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.

`def` findIndexOf (p: (A) => scala.Boolean): scala.Int

  Returns index of the first element satisying a predicate, or -1.

Parameters:
  `p -` the predicate
Returns:
  the index of the first element satisfying `p`, or -1 if such an element does not exist

`def` flatMap [B](f: (A) => scala.Iterable[B]): scala.Iterable[B]

  Applies the given function `f` to each element of this iterable, then concatenates the results.

Parameters:
  `f -` the function to apply on each element.
Returns:
  `f(a0) ::: ... ::: f(an)` if this iterable is `a0, ..., an`.

`def` foldLeft [B](z: B)(op: (B, A) => B): B

  Combines the elements of this iterable object together using the binary function `f`, from left to right, and starting with the value `z`.

Returns:
  `f(... (f(f(z, a0), a1) ...), an)` if the list is `[a0, a1, ..., an]`.

`def` foldRight [B](z: B)(op: (A, B) => B): B

  Combines the elements of this list together using the binary function `f`, from right to left, and starting with the value `z`.

Returns:
  `f(a0, f(a1, f(..., f(an, z)...)))` if the list is `[a0, a1, ..., an]`.

`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.

Parameters:
  `p -` the predicate
Returns:
  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.

Parameters:
  `f -` a function that is applied to every element.

`def` indexOf [B >: A](elem: B): scala.Int

  Returns the index of the first occurence of the specified object in this iterable object.

Parameters:
  `elem -` element to search for.
Returns:
  the index in this sequence of the first occurence of the specified element, or -1 if the sequence does not contain this element.

`def` map [B](f: (A) => B): scala.Iterable[B]

  Returns the iterable resulting from applying the given function `f` to each element of this iterable.

Parameters:
  `f -` function to apply to each element.
Returns:
  `f(a0), ..., f(an)` if this iterable is `a0, ..., an`.

`def` mkString (sep: java.lang.String): java.lang.String

  Returns a string representation of this iterable object. The string representations of elements (w.r.t. the method `toString()`) are separated by the string `sep`.

Parameters:
  `sep -` separator string.
Returns:
  a string representation of this iterable object.

`def` mkString (start: java.lang.String, sep: java.lang.String, end: java.lang.String): java.lang.String

  Returns a string representation of this iterable object. The resulting string begins with the string `start` and is finished by the string `end`. Inside, the string representations of elements (w.r.t. the method `toString()`) are separated by the string `sep`.

  Ex:
  `List(1, 2, 3).mkString("(", "; ", ")") = "(1; 2; 3)"`

Parameters:
  `start -` starting string.
Parameters:
  `sep -` separator string.
Parameters:
  `end -` ending string.
Returns:
  a string representation of this iterable object.

`def` reduceLeft [B >: A](op: (B, B) => B): B

  Combines the elements of this iterable object together using the binary operator `op`, from left to right

Parameters:
  `op -` The operator to apply
Returns:
  `op(... op(a0,a1), ..., an)` if the iterable object has elements `a0, a1, ..., an`.
Throws:
  `Predef.UnsupportedOperationException -` if the iterable object is empty.

`def` reduceRight [B >: A](op: (B, B) => B): B

  Combines the elements of this iterable object together using the binary operator `op`, from right to left

Parameters:
  `op -` The operator to apply
Returns:
  `a0 op (... op (an-1 op an)...)` if the iterable object has elements `a0, a1, ..., an`.
Throws:
  `Predef.UnsupportedOperationException -` if the iterator is empty.

`def` sameElements [B >: A](that: scala.Iterable[B]): scala.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.

`def` take (n: scala.Int): scala.Iterable[A]

  Returns an iterable consisting only over the first `n` elements of this iterable, or else the whole iterable, if it has less than `n` elements.

Parameters:
  `n -` the number of elements to take
Returns:
  the new iterable

`def` takeWhile (p: (A) => scala.Boolean): scala.Iterable[A]

  Returns the longest prefix of this iterable whose elements satisfy the predicate `p`.

Parameters:
  `p -` the test predicate.
Returns:
  the longest prefix of this iterable whose elements satisfy the predicate `p`.

`def` toList : scala.List[A]

Returns:
  a list with all the elements of this iterable object