scala.collection

IterableLike

trait IterableLike[+A, +Repr] extends Equals with TraversableLike[A, Repr]

A template trait for iterable collections of type Iterable[A]. $iterableInfo

A

the element type of the collection

Repr

the type of the actual collection containing the elements.

known subclasses: Iterable, SeqLike, Iterable, SetLike, Iterable, MapLike, IterableViewLike, IterableProxyLike

Inherits

  1. TraversableLike
  2. HasNewBuilder
  3. Equals
  4. AnyRef
  5. Any

Type Members

  1. class WithFilter extends AnyRef

    A class supporting filtered operations

Value Members

  1. def ++(that: Iterator[A]): Iterable[A]

    [use case] Concatenates this iterable collection with the elements of an iterator

    [use case]

    Concatenates this iterable collection with the elements of an iterator.

    that

    the iterator to append.

    returns

    a new iterable collection which contains all elements of this iterable collection followed by all elements of that.

    attributes: abstract
  2. def ++[B >: A, That](that: Iterator[B])(bf: CanBuildFrom[Repr, B, That]): That

    Concatenates this iterable collection with the elements of an iterator

    Concatenates this iterable collection with the elements of an iterator.

    B

    the element type of the returned collection.

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type B being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, B, That] is found.

    that

    the iterator to append.

    bf

    an implicit value of class CanBuildFrom which determines the result class That from the current representation type Repr and and the new element type B.

    returns

    a new collection of type That which contains all elements of this iterable collection followed by all elements of that.

    definition classes: TraversableLike
  3. def ++(that: Traversable[A]): Iterable[A]

    [use case] Concatenates this iterable collection with the elements of a traversable collection

    [use case]

    Concatenates this iterable collection with the elements of a traversable collection.

    that

    the traversable to append.

    returns

    a new iterable collection which contains all elements of this iterable collection followed by all elements of that.

    attributes: abstract
  4. def ++[B >: A, That](that: Traversable[B])(bf: CanBuildFrom[Repr, B, That]): That

    Concatenates this iterable collection with the elements of a traversable collection

    Concatenates this iterable collection with the elements of a traversable collection.

    B

    the element type of the returned collection.

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type B being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, B, That] is found.

    that

    the traversable to append.

    bf

    an implicit value of class CanBuildFrom which determines the result class That from the current representation type Repr and and the new element type B.

    returns

    a new collection of type That which contains all elements of this iterable collection followed by all elements of that.

    definition classes: TraversableLike
  5. def /:[B](z: B)(op: (B, A) ⇒ B): B

    Applies a binary operator to a start value and all elements of this iterable collection, going left to right

    Applies a binary operator to a start value and all elements of this iterable collection, going left to right.

    Note: /: is alternate syntax for foldLeft; z /: xs is the same as xs foldLeft z.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    z

    the start value.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this iterable collection$, going left to right with the start value z on the left: {{{ op(...op(op(z, x1), x2), ..., xn) }}} where x,,1,,, ..., x,,n,, are the elements of this iterable collection.

    definition classes: TraversableLike
  6. def :\[B](z: B)(op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this iterable collection and a start value, going right to left

    Applies a binary operator to all elements of this iterable collection and a start value, going right to left.

    Note: :\ is alternate syntax for foldRight; xs :\ z is the same as xs foldRight z.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    z

    the start value

    op

    the binary operator

    returns

    the result of inserting op between consecutive elements of this iterable collection$, going right to left with the start value z on the right: {{{ op(x1, op(x2, ... op(xn, z)...)) }}} where x,,1,,, ..., x,,n,, are the elements of this iterable collection.

    definition classes: TraversableLike
  7. def addString(b: StringBuilder): StringBuilder

    Appends all elements of this iterable collection to a string builder

    Appends all elements of this iterable collection to a string builder. The written text consists of the string representations (w.r.t. the method toString) of all elements of this iterable collection without any separator string.

    b

    the string builder to which elements are appended.

    returns

    the string builder b to which elements were appended.

    definition classes: TraversableLike
  8. def addString(b: StringBuilder, sep: String): StringBuilder

    Appends all elements of this iterable collection to a string builder using a separator string

    Appends all elements of this iterable collection to a string builder using a separator string. The written text consists of the string representations (w.r.t. the method toString) of all elements of this iterable collection, separated by the string sep.

    b

    the string builder to which elements are appended.

    sep

    the separator string.

    returns

    the string builder b to which elements were appended.

    definition classes: TraversableLike
  9. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Appends all elements of this iterable collection to a string builder using start, end, and separator strings

    Appends all elements of this iterable collection to a string builder using start, end, and separator strings. The written text begins with the string start and ends with the string end. Inside, the string representations (w.r.t. the method toString) of all elements of this iterable collection are separated by the string sep.

    b

    the string builder to which elements are appended.

    start

    the starting string.

    sep

    the separator string.

    end

    the ending string.

    returns

    the string builder b to which elements were appended.

    definition classes: TraversableLike
  10. def canEqual(that: Any): Boolean

    Method called from equality methods, so that user-defined subclasses can refuse to be equal to other collections of the same kind

    Method called from equality methods, so that user-defined subclasses can refuse to be equal to other collections of the same kind.

    that

    The object with which this iterable collection should be compared

    returns

    true, if this iterable collection can possibly equal that, false otherwise. The test takes into consideration only the run-time types of objects but ignores their elements.

  11. def copyToArray(xs: Array[A], start: Int, len: Int): Unit

    [use case] Copies elements of this iterable collection to an array

    [use case]

    Copies elements of this iterable collection to an array. Fills the given array xs with at most len elements of this iterable collection, starting at position start. Copying will stop once either the end of the current iterable collection is reached, or the end of the array is reached, or len elements have been copied.

    xs

    the array to fill.

    start

    the starting index.

    len

    the maximal number of elements to copy.

    attributes: abstract
  12. def copyToArray[B >: A](xs: Array[B], start: Int, len: Int): Unit

    Copies elements of this iterable collection to an array

    Copies elements of this iterable collection to an array. Fills the given array xs with at most len elements of this iterable collection, starting at position start. Copying will stop once either the end of the current iterable collection is reached, or the end of the array is reached, or len elements have been copied.

    Note: will not terminate for infinite-sized collections.

    B

    the type of the elements of the array.

    xs

    the array to fill.

    start

    the starting index.

    len

    the maximal number of elements to copy.

  13. def copyToArray(xs: Array[A], start: Int): Unit

    [use case] Copies elements of this iterable collection to an array

    [use case]

    Copies elements of this iterable collection to an array. Fills the given array xs with all elements of this iterable collection, starting at position 0. Copying will stop once either the end of the current iterable collection is reached, or the end of the array is reached.

    xs

    the array to fill.

    attributes: abstract
  14. def copyToArray[B >: A](xs: Array[B]): Unit

    Copies elements of this iterable collection to an array

    Copies elements of this iterable collection to an array. Fills the given array xs with all elements of this iterable collection, starting at position 0. Copying will stop once either the end of the current iterable collection is reached, or the end of the array is reached.

    Note: will not terminate for infinite-sized collections.

    B

    the type of the elements of the array.

    xs

    the array to fill.

    definition classes: TraversableLike
  15. def copyToArray(xs: Array[A], start: Int): Unit

    [use case] Copies elements of this iterable collection to an array

    [use case]

    Copies elements of this iterable collection to an array. Fills the given array xs with all elements of this iterable collection, starting at position start. Copying will stop once either the end of the current iterable collection is reached, or the end of the array is reached.

    xs

    the array to fill.

    start

    the starting index.

    attributes: abstract
  16. def copyToArray[B >: A](xs: Array[B], start: Int): Unit

    Copies elements of this iterable collection to an array

    Copies elements of this iterable collection to an array. Fills the given array xs with all elements of this iterable collection, starting at position start. Copying will stop once either the end of the current iterable collection is reached, or the end of the array is reached.

    Note: will not terminate for infinite-sized collections.

    B

    the type of the elements of the array.

    xs

    the array to fill.

    start

    the starting index.

    definition classes: TraversableLike
  17. def copyToBuffer[B >: A](dest: Buffer[B]): Unit

    Copies all elements of this iterable collection to a buffer

    Copies all elements of this iterable collection to a buffer.

    Note: will not terminate for infinite-sized collections.

    dest

    The buffer to which elements are copied.

    definition classes: TraversableLike
  18. def count(p: (A) ⇒ Boolean): Int

    Counts the number of elements in the iterable collection which satisfy a predicate

    Counts the number of elements in the iterable collection which satisfy a predicate.

    p

    the predicate used to test elements.

    returns

    the number of elements satisfying the predicate p.

    definition classes: TraversableLike
  19. def drop(n: Int): Repr

    Selects all elements except first n ones

    Selects all elements except first n ones.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    n

    the number of elements to drop from this iterable collection.

    returns

    a iterable collection consisting of all elements of this iterable collection except the first n ones, or else the empty iterable collection, if this iterable collection has less than n elements.

    definition classes: TraversableLike
  20. def dropRight(n: Int): Repr

    Selects all elements except first n ones

    Selects all elements except first n ones.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    n

    The number of elements to take

    returns

    a iterable collection consisting of all elements of this iterable collection except the first n ones, or else the empty iterable collection, if this iterable collection has less than n elements.

  21. def dropWhile(p: (A) ⇒ Boolean): Repr

    Drops longest prefix of elements that satisfy a predicate

    Drops longest prefix of elements that satisfy a predicate.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    p

    The predicate used to test elements.

    returns

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

    definition classes: TraversableLike
  22. def elements: Iterator[A]

  23. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
  24. def exists(p: (A) ⇒ Boolean): Boolean

    Tests whether a predicate holds for some of the elements of this iterable collection

    Tests whether a predicate holds for some of the elements of this iterable collection.

    Note: may not terminate for infinite-sized collections.

    p

    the predicate used to test elements.

    returns

    true if the given predicate p holds for some of the elements of this iterable collection, otherwise false.

  25. def filter(p: (A) ⇒ Boolean): Repr

    Selects all elements of this iterable collection which satisfy a predicate

    Selects all elements of this iterable collection which satisfy a predicate.

    p

    the predicate used to test elements.

    returns

    a new iterable collection consisting of all elements of this iterable collection that satisfy the given predicate p. The order of the elements is preserved.

    definition classes: TraversableLike
  26. def filterNot(p: (A) ⇒ Boolean): Repr

    Selects all elements of this iterable collection which do not satisfy a predicate

    Selects all elements of this iterable collection which do not satisfy a predicate.

    p

    the predicate used to test elements.

    returns

    a new iterable collection consisting of all elements of this iterable collection that do not satisfy the given predicate p. The order of the elements is preserved.

    definition classes: TraversableLike
  27. def find(p: (A) ⇒ Boolean): Option[A]

    Finds the first element of the iterable collection satisfying a predicate, if any

    Finds the first element of the iterable collection satisfying a predicate, if any.

    Note: may not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    p

    the predicate used to test elements.

    returns

    an option value containing the first element in the iterable collection that satisfies p, or None if none exists.

  28. def first: A

  29. def firstOption: Option[A]

    None if iterable is empty

    None if iterable is empty.

  30. def flatMap[B](f: (A) ⇒ Traversable[B]): Iterable[B]

    [use case] Builds a new collection by applying a function to all elements of this iterable collection and concatenating the results

    [use case]

    Builds a new collection by applying a function to all elements of this iterable collection and concatenating the results.

    B

    the element type of the returned collection.

    f

    the function to apply to each element.

    returns

    a new iterable collection resulting from applying the given collection-valued function f to each element of this iterable collection and concatenating the results.

    attributes: abstract
  31. def flatMap[B, That](f: (A) ⇒ Traversable[B])(bf: CanBuildFrom[Repr, B, That]): That

    Builds a new collection by applying a function to all elements of this iterable collection and concatenating the results

    Builds a new collection by applying a function to all elements of this iterable collection and concatenating the results.

    B

    the element type of the returned collection.

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type B being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, B, That] is found.

    f

    the function to apply to each element.

    bf

    an implicit value of class CanBuildFrom which determines the result class That from the current representation type Repr and and the new element type B.

    returns

    a new collection of type That resulting from applying the given collection-valued function f to each element of this iterable collection and concatenating the results.

    definition classes: TraversableLike
  32. def foldLeft[B](z: B)(op: (B, A) ⇒ B): B

    Applies a binary operator to a start value and all elements of this iterable collection, going left to right

    Applies a binary operator to a start value and all elements of this iterable collection, going left to right.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    z

    the start value.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this iterable collection$, going left to right with the start value z on the left: {{{ op(...op(z, x1), x2, ..., xn) }}} where x,,1,,, ..., x,,n,, are the elements of this iterable collection.

    definition classes: TraversableLike
  33. def foldRight[B](z: B)(op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this iterable collection and a start value, going right to left

    Applies a binary operator to all elements of this iterable collection and a start value, going right to left.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    z

    the start value.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this iterable collection$, going right to left with the start value z on the right: {{{ op(x1, op(x2, ... op(xn, z)...)) }}} where x,,1,,, ..., x,,n,, are the elements of this iterable collection.

  34. def forall(p: (A) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all elements of this iterable collection

    Tests whether a predicate holds for all elements of this iterable collection.

    Note: may not terminate for infinite-sized collections.

    p

    the predicate used to test elements.

    returns

    true if the given predicate p holds for all elements of this iterable collection, otherwise false.

  35. def foreach(f: (A) ⇒ Unit): Unit

    [use case] Applies a function f to all elements of this iterable collection

    [use case]

    Applies a function f to all elements of this iterable collection.

    f

    the function that is applied for its side-effect to every element. The result of function f is discarded.

    attributes: abstract
  36. def foreach[U](f: (A) ⇒ U): Unit

    Applies a function f to all elements of this iterable collection

    Applies a function f to all elements of this iterable collection.

    Note: this method underlies the implementation of most other bulk operations. Subclasses should re-implement this method if a more efficient implementation exists.

    U

    the type parameter describing the result of function f. This result will always be ignored. Typically U is Unit, but this is not necessary.

    f

    the function that is applied for its side-effect to every element. The result of function f is discarded.

  37. def groupBy[K](f: (A) ⇒ K): Map[K, Repr]

    Partitions this iterable collection into a map of iterable collections according to some discriminator function

    Partitions this iterable collection into a map of iterable collections according to some discriminator function.

    Note: this method is not re-implemented by views. This means when applied to a view it will always force the view and return a new iterable collection.

    K

    the type of keys returned by the discriminator function.

    f

    the discriminator function.

    returns

    A map from keys to iterable collections such that the following invariant holds: {{{ (xs partition f)(k) = xs filter (x => f(x) == k) }}} That is, every key k is bound to a iterable collection of those elements x for which f(x) equals k.

    definition classes: TraversableLike
  38. def grouped(size: Int): Iterator[Repr]

    Partitions elements in fixed size iterable collections

    Partitions elements in fixed size iterable collections.

    size

    the number of elements per group

    returns

    An iterator producing iterable collections of size size, except the last will be truncated if the elements don't divide evenly.

  39. def hasDefiniteSize: Boolean

    Tests whether this iterable collection is known to have a finite size

    Tests whether this iterable collection is known to have a finite size. All strict collections are known to have finite size. For a non-strict collection such as Stream, the predicate returns true if all elements have been computed. It returns false if the stream is not yet evaluated to the end.

    Note: many collection methods will not work on collections of infinite sizes.

    definition classes: TraversableLike
  40. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
  41. def head: A

    Selects the first element of this iterable collection

    Selects the first element of this iterable collection.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

  42. def headOption: Option[A]

    Optionally selects the first element

    Optionally selects the first element.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    definition classes: TraversableLike
  43. def init: Repr

    Selects all elements except the last

    Selects all elements except the last.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    definition classes: TraversableLike
  44. def isEmpty: Boolean

    Tests whether this iterable collection is empty

    Tests whether this iterable collection is empty.

  45. def iterator: Iterator[A]

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

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

    attributes: abstract
  46. def last: A

    Selects the last element

    Selects the last element.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    definition classes: TraversableLike
  47. def lastOption: Option[A]

    Optionally selects the last element

    Optionally selects the last element.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    definition classes: TraversableLike
  48. def map[B](f: (A) ⇒ B): Iterable[B]

    [use case] Builds a new collection by applying a function to all elements of this iterable collection

    [use case]

    Builds a new collection by applying a function to all elements of this iterable collection.

    B

    the element type of the returned collection.

    f

    the function to apply to each element.

    returns

    a new iterable collection resulting from applying the given function f to each element of this iterable collection and collecting the results.

    attributes: abstract
  49. def map[B, That](f: (A) ⇒ B)(bf: CanBuildFrom[Repr, B, That]): That

    Builds a new collection by applying a function to all elements of this iterable collection

    Builds a new collection by applying a function to all elements of this iterable collection.

    B

    the element type of the returned collection.

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type B being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, B, That] is found.

    f

    the function to apply to each element.

    bf

    an implicit value of class CanBuildFrom which determines the result class That from the current representation type Repr and and the new element type B.

    returns

    a new collection of type That resulting from applying the given function f to each element of this iterable collection and collecting the results.

    definition classes: TraversableLike
  50. def max[B >: A](cmp: Ordering[B]): A

    Finds the largest element

    Finds the largest element.

    B

    The type over which the ordering is defined.

    cmp

    An ordering to be used for comparing elements.

    returns

    the largest element of this iterable collection with respect to the ordering cmp.

    definition classes: TraversableLike
  51. def min: A

    [use case] Finds the largest element

    [use case]

    Finds the largest element.

    attributes: abstract
  52. def min: A

    [use case] Finds the smallest element

    [use case]

    Finds the smallest element.

    attributes: abstract
  53. def min[B >: A](cmp: Ordering[B]): A

    Finds the smallest element

    Finds the smallest element.

    B

    The type over which the ordering is defined.

    cmp

    An ordering to be used for comparing elements.

    returns

    the smallest element of this iterable collection with respect to the ordering cmp.

    definition classes: TraversableLike
  54. def mkString: String

    Displays all elements of this iterable collection in a string

    Displays all elements of this iterable collection in a string.

    definition classes: TraversableLike
  55. def mkString(sep: String): String

    Displays all elements of this iterable collection in a string using a separator string

    Displays all elements of this iterable collection in a string using a separator string.

    sep

    the separator string.

    returns

    a string representation of this iterable collection. In the resulting string the string representations (w.r.t. the method toString) of all elements of this iterable collection are separated by the string sep.

    definition classes: TraversableLike
  56. def mkString(start: String, sep: String, end: String): String

    Displays all elements of this iterable collection in a string using start, end, and separator strings

    Displays all elements of this iterable collection in a string using start, end, and separator strings.

    start

    the starting string.

    sep

    the separator string.

    end

    the ending string.

    returns

    a string representation of this iterable collection. The resulting string begins with the string start and ends with the string end. Inside, the string representations (w.r.t. the method toString) of all elements of this iterable collection are separated by the string sep.

    definition classes: TraversableLike
  57. def nonEmpty: Boolean

    Tests whether the iterable collection is not empty

    Tests whether the iterable collection is not empty.

    definition classes: TraversableLike
  58. def partialMap[B](pf: PartialFunction[A, B]): Iterable[B]

    [use case] Builds a new collection by applying a partial function to all elements of this iterable collection on which the function is defined

    [use case]

    Builds a new collection by applying a partial function to all elements of this iterable collection on which the function is defined.

    B

    the element type of the returned collection.

    pf

    the partial function which filters and maps the iterable collection.

    returns

    a new iterable collection resulting from applying the given partial function pf to each element on which it is defined and collecting the results. The order of the elements is preserved.

    attributes: abstract
  59. def partialMap[B, That](pf: PartialFunction[A, B])(bf: CanBuildFrom[Repr, B, That]): That

    Builds a new collection by applying a partial function to all elements of this iterable collection on which the function is defined

    Builds a new collection by applying a partial function to all elements of this iterable collection on which the function is defined.

    B

    the element type of the returned collection.

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type B being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, B, That] is found.

    pf

    the partial function which filters and maps the iterable collection.

    bf

    an implicit value of class CanBuildFrom which determines the result class That from the current representation type Repr and and the new element type B.

    returns

    a new collection of type That resulting from applying the partial function pf to each element on which it is defined and collecting the results. The order of the elements is preserved.

    definition classes: TraversableLike
  60. def partition(p: (A) ⇒ Boolean): (Repr, Repr)

    Partitions this iterable collection in two iterable collections according to a predicate

    Partitions this iterable collection in two iterable collections according to a predicate.

    p

    the predicate on which to partition.

    returns

    a pair of iterable collections: the first iterable collection consists of all elements that satisfy the predicate p and the second iterable collection consists of all elements that don't. The relative order of the elements in the resulting iterable collections is the same as in the original iterable collection.

    definition classes: TraversableLike
  61. def product: Int

    [use case] Multiplies up the elements of this collection

    [use case]

    Multiplies up the elements of this collection.

    attributes: abstract
  62. def product[B >: A](num: Numeric[B]): B

    Multiplies up the elements of this collection

    Multiplies up the elements of this collection.

    B

    the result type of the * operator.

    num

    an implicit parameter defining a set of numeric operations which includes the * operator to be used in forming the product.

    returns

    the product of all elements of this iterable collection with respect to the * operator in num.

    definition classes: TraversableLike
  63. def projection: IterableView[A, Repr]

    returns a projection that can be used to call non-strict filter,map, and flatMap methods that build projections of the collection

    returns a projection that can be used to call non-strict filter,map, and flatMap methods that build projections of the collection.

  64. def reduceLeft[B >: A](op: (B, A) ⇒ B): B

    Applies a binary operator to all elements of this iterable collection, going left to right

    Applies a binary operator to all elements of this iterable collection, going left to right.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this iterable collection$, going left to right: {{{ op(...(op(x1, x2), ... ) , xn) }}} where x,,1,,, ..., x,,n,, are the elements of this iterable collection.

    definition classes: TraversableLike
  65. def reduceLeftOption[B >: A](op: (B, A) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this iterable collection, going left to right

    Optionally applies a binary operator to all elements of this iterable collection, going left to right.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    op

    the binary operator.

    returns

    an option value containing the result of reduceLeft(op) is this iterable collection is nonempty, None otherwise.

    definition classes: TraversableLike
  66. def reduceRight[B >: A](op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this iterable collection, going right to left

    Applies a binary operator to all elements of this iterable collection, going right to left.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this iterable collection$, going right to left: {{{ op(x1, op(x2, ..., op(xn-1, xn)...)) }}} where x,,1,,, ..., x,,n,, are the elements of this iterable collection.

  67. def reduceRightOption[B >: A](op: (A, B) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this iterable collection, going right to left

    Optionally applies a binary operator to all elements of this iterable collection, going right to left.

    Note: will not terminate for infinite-sized collections.

    Note: might return different results for different runs, unless the underlying collection type is ordered. or the operator is associative and commutative.

    B

    the result type of the binary operator.

    op

    the binary operator.

    returns

    an option value containing the result of reduceRight(op) is this iterable collection is nonempty, None otherwise.

    definition classes: TraversableLike
  68. def repr: Repr

    The collection of type iterable collection underlying this TraversableLike object

    The collection of type iterable collection underlying this TraversableLike object. By default this is implemented as the TraversableLike object itself, but this can be overridden.

    definition classes: TraversableLike
  69. def sameElements(that: Iterable[A]): Boolean

    [use case] Checks if the other iterable collection contains the same elements in the same order as this iterable collection

    [use case]

    Checks if the other iterable collection contains the same elements in the same order as this iterable collection.

    that

    the collection to compare with.

    returns

    true, if both collections contain the same elements in the same order, false otherwise.

    attributes: abstract
  70. def sameElements[B >: A](that: Iterable[B]): Boolean

    Checks if the other iterable collection contains the same elements in the same order as this iterable collection

    Checks if the other iterable collection contains the same elements in the same order as this iterable collection.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    Note: will not terminate for infinite-sized collections.

    B

    the type of the elements of collection that.

    that

    the collection to compare with.

    returns

    true, if both collections contain the same elements in the same order, false otherwise.

  71. def size: Int

    The size of this iterable collection

    The size of this iterable collection.

    Note: will not terminate for infinite-sized collections.

    definition classes: TraversableLike
  72. def slice(from: Int, until: Int): Repr

    Selects an interval of elements

    Selects an interval of elements.

    Note: c.slice(from, to) is equivalent to (but possibly more efficient than) c.drop(from).take(to - from)

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    from

    the index of the first returned element in this iterable collection.

    until

    the index one past the last returned element in this iterable collection.

    returns

    a iterable collection containing the elements starting at index from and extending up to (but not including) index until of this iterable collection.

  73. def sliding[B >: A](size: Int, step: Int): Iterator[Repr]

  74. def sliding[B >: A](size: Int): Iterator[Repr]

    Groups elements in fixed size blocks by passing a "sliding window" over them (as opposed to partitioning them, as is done in grouped

    Groups elements in fixed size blocks by passing a "sliding window" over them (as opposed to partitioning them, as is done in grouped.)

    size

    the number of elements per group

    returns

    An iterator producing iterable collections of size size, except the last will be truncated if the elements don't divide evenly.

  75. def span(p: (A) ⇒ Boolean): (Repr, Repr)

    Spits this iterable collection into a prefix/suffix pair according to a predicate

    Spits this iterable collection into a prefix/suffix pair according to a predicate.

    Note: c span p is equivalent to (but possibly more efficient than) (c takeWhile p, c dropWhile p), provided the evaluation of the predicate p does not cause any side-effects.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    p

    the test predicate

    returns

    a pair consisting of the longest prefix of this iterable collection whose elements all satisfy p, and the rest of this iterable collection.

    definition classes: TraversableLike
  76. def splitAt(n: Int): (Repr, Repr)

    Splits this iterable collection into two at a given position

    Splits this iterable collection into two at a given position. Note: c splitAt n is equivalent to (but possibly more efficient than) (c take n, c drop n).

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    n

    the position at which to split.

    returns

    a pair of iterable collections consisting of the first n elements of this iterable collection, and the other elements.

    definition classes: TraversableLike
  77. def stringPrefix: String

    Defines the prefix of this object's toString representation

    Defines the prefix of this object's toString representation.

    definition classes: TraversableLike
  78. def sum: Int

    [use case] Sums up the elements of this collection

    [use case]

    Sums up the elements of this collection.

    attributes: abstract
  79. def sum[B >: A](num: Numeric[B]): B

    Sums up the elements of this collection

    Sums up the elements of this collection.

    B

    the result type of the + operator.

    num

    an implicit parameter defining a set of numeric operations which includes the + operator to be used in forming the sum.

    returns

    the sum of all elements of this iterable collection with respect to the + operator in num.

    definition classes: TraversableLike
  80. def tail: Repr

    Selects all elements except the first

    Selects all elements except the first.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    definition classes: TraversableLike
  81. def take(n: Int): Repr

    Selects first n elements

    Selects first n elements.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    n

    Tt number of elements to take from this iterable collection.

    returns

    a iterable collection consisting only of the first n elements of this iterable collection, or else the whole iterable collection, if it has less than n elements.

  82. def takeRight(n: Int): Repr

    Selects last n elements

    Selects last n elements.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    n

    the number of elements to take

    returns

    a iterable collection consisting only of the last n elements of this iterable collection, or else the whole iterable collection, if it has less than n elements.

  83. def takeWhile(p: (A) ⇒ Boolean): Repr

    Takes longest prefix of elements that satisfy a predicate

    Takes longest prefix of elements that satisfy a predicate.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    p

    The predicate used to test elements.

    returns

    the longest prefix of this iterable collection whose elements all satisfy the predicate p.

  84. def toArray: Array[A]

    [use case] Converts this iterable collection to an array

    [use case]

    Converts this iterable collection to an array.

    Note: will not terminate for infinite-sized collections.

    attributes: abstract
  85. def toArray[B >: A](arg0: ClassManifest[B]): Array[B]

    Converts this iterable collection to an array

    Converts this iterable collection to an array.

    Note: will not terminate for infinite-sized collections.

    B

    the type of the elements of the array. A ClassManifest for this type must be available.

    returns

    an array containing all elements of this iterable collection.

    definition classes: TraversableLike
  86. def toIndexedSeq[B >: A]: IndexedSeq[B]

    Converts this iterable collection to an indexed sequence

    Converts this iterable collection to an indexed sequence.

    Note: will not terminate for infinite-sized collections.

    definition classes: TraversableLike
  87. def toIterable: Iterable[A]

    Converts this iterable collection to an iterable collection

    Converts this iterable collection to an iterable collection.

    Note: will not terminate for infinite-sized collections.

  88. def toList: List[A]

    Converts this iterable collection to a list

    Converts this iterable collection to a list.

    Note: will not terminate for infinite-sized collections.

    definition classes: TraversableLike
  89. def toMap[T, U](ev: <:<[A, (T, U)]): Map[T, U]

    Converts this iterable collection to a map

    Converts this iterable collection to a map. This method is unavailable unless the elements are members of Tuple2, each ((K, V)) becoming a key-value pair in the map. Duplicate keys will be overwritten by later keys: if this is an unordered collection, which key is in the resulting map is undefined.

    Note: will not terminate for infinite-sized collections.

    definition classes: TraversableLike
  90. def toSeq: Seq[A]

    Converts this iterable collection to a sequence

    Converts this iterable collection to a sequence.

    Note: will not terminate for infinite-sized collections.

    definition classes: TraversableLike
  91. def toSet[B >: A]: Set[B]

    Converts this iterable collection to a set

    Converts this iterable collection to a set.

    Note: will not terminate for infinite-sized collections.

    definition classes: TraversableLike
  92. def toStream: Stream[A]

    Converts this iterable collection to a stream

    Converts this iterable collection to a stream.

    Note: will not terminate for infinite-sized collections.

  93. def toString(): String

    Converts this iterable collection to a string

    Converts this iterable collection to a string

    definition classes: TraversableLike ⇐ AnyRef ⇐ Any
  94. def view(from: Int, until: Int): IterableView[A, Repr]

    Creates a non-strict view of a slice of this iterable collection

    Creates a non-strict view of a slice of this iterable collection.

    Note: the difference between view and slice is that view produces a view of the current iterable collection, whereas slice produces a new iterable collection.

    Note: view(from, to) is equivalent to view.slice(from, to)

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    from

    the index of the first element of the view

    until

    the index of the element following the view

    returns

    a non-strict view of a slice of this iterable collection, starting at index from and extending up to (but not including) index until.

  95. def view: IterableView[A, Repr]

    Creates a non-strict view of this iterable collection

    Creates a non-strict view of this iterable collection.

  96. def withFilter(p: (A) ⇒ Boolean): WithFilter

    Creates a non-strict filter of this iterable collection

    Creates a non-strict filter of this iterable collection.

    Note: the difference between c filter p and c withFilter p is that the former creates a new collection, whereas the latter only restricts the domain of subsequent map, flatMap, foreach, and withFilter operations.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    p

    the predicate used to test elements.

    returns

    an object of class WithFilter, which supports map, flatMap, foreach, and withFilter operations. All these operations apply to those elements of this iterable collection which satify the predicate p.

    definition classes: TraversableLike
  97. def zip[B](that: Iterable[B]): Iterable[(A, B)]

    [use case] Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs

    [use case]

    Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.

    B

    the type of the second half of the returned pairs

    that

    The iterable providing the second half of each result pair

    returns

    a new iterable collection containing pairs consisting of corresponding elements of this iterable collection and that. The length of the returned collection is the minimum of the lengths of this iterable collection$ and that.

    attributes: abstract
  98. def zip[A1 >: A, B, That](that: Iterable[B])(bf: CanBuildFrom[Repr, (A1, B), That]): That

    Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs

    Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    A1

    the type of the first half of the returned pairs (this is always a supertype of the collection's element type A).

    B

    the type of the second half of the returned pairs

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type (A1, B) being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, (A1, B), That]. is found.

    that

    The iterable providing the second half of each result pair

    bf

    an implicit value of class CanBuildFrom which determines the result class That from the current representation type Repr and the new element type (A1, B).

    returns

    a new collection of type That containing pairs consisting of corresponding elements of this iterable collection and that. The length of the returned collection is the minimum of the lengths of this iterable collection$ and that.

  99. def zipAll[B](that: Iterable[B], thisElem: A, thatElem: B): Iterable[(A, B)]

    [use case] Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs

    [use case]

    Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs. If one of the two collections is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the longer.

    B

    the type of the second half of the returned pairs

    that

    The iterable providing the second half of each result pair

    thisElem

    the element to be used to fill up the result if this iterable collection is shorter than that.

    thatElem

    the element to be used to fill up the result if that is shorter than this iterable collection.

    returns

    a new iterable collection containing pairs consisting of corresponding elements of this iterable collection and that. The length of the returned collection is the maximum of the lengths of this iterable collection$ and that. If this iterable collection is shorter than that, thisElem values are used to pad the result. If that is shorter than this iterable collection, thatElem values are used to pad the result.

    attributes: abstract
  100. def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(bf: CanBuildFrom[Repr, (A1, B), That]): That

    Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs

    Returns a iterable collection formed from this iterable collection and another iterable collection by combining corresponding elements in pairs. If one of the two collections is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the longer.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    that

    the iterable providing the second half of each result pair

    thisElem

    the element to be used to fill up the result if this iterable collection is shorter than that.

    thatElem

    the element to be used to fill up the result if that is shorter than this iterable collection.

    returns

    a new collection of type That containing pairs consisting of corresponding elements of this iterable collection and that. The length of the returned collection is the maximum of the lengths of this iterable collection$ and that. If this iterable collection is shorter than that, thisElem values are used to pad the result. If that is shorter than this iterable collection, thatElem values are used to pad the result.

  101. def zipWithIndex: Iterable[(A, Int)]

    [use case] Zips this iterable collection with its indices

    [use case]

    Zips this iterable collection with its indices.

    attributes: abstract
  102. def zipWithIndex[A1 >: A, That](bf: CanBuildFrom[Repr, (A1, Int), That]): That

    Zips this iterable collection with its indices

    Zips this iterable collection with its indices.

    Note: might return different results for different runs, unless the underlying collection type is ordered.

    A1

    the type of the first half of the returned pairs (this is always a supertype of the collection's element type A).

    That

    the class of the returned collection. Where possible, That is the same class as the current collection class Repr, but this depends on the element type (A1, Int) being admissible for that class, which means that an implicit instance of type CanBuildFrom[Repr, (A1, Int), That]. is found.

    returns

    A new collection of type That containing pairs consisting of all elements of this iterable collection paired with their index. Indices start at 0.