scala.collection

trait Iterable

[source: scala/collection/Iterable.scala]

trait Iterable[+A]
extends Traversable[A] with GenericTraversableTemplate[A, Iterable] with IterableLike[A, Iterable[A]]

A template trait for iterable collections.

Collection classes mixing in this trait provide a method iterator which returns an iterator over all the elements contained in the collection. They also provide a method newBuilder which creates a builder for collections of the same kind.

This trait implements Traversable's foreach method by stepping through all elements. Subclasses of Iterable should re-implement foreach with something more efficient, if possible.

This trait adds methods iterator, zip, zipAll, zipWithIndex, sameElements, takeRight, dropRight to the methods inherited from trait Traversable.

Author
Martin Odersky
Version
2.8
Since
2.8
Direct Known Subclasses:
IterableProxy, IterableViewLike, JavaConversions.JIterableWrapper, JavaConversions.JCollectionWrapper, Map, MapLike.DefaultValuesIterable, Seq, Set, IterableForwarder, Iterable, Iterable, Binders.Scope, MetaData

Method Summary
override def companion : GenericCompanion[Iterable]
The factory companion object that builds instances of class CC
Methods inherited from IterableLike
iterator (abstract), thisCollection, toCollection, elements, foreach, forall, exists, find, isEmpty, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, view, view, first, firstOption, projection
Methods inherited from GenericTraversableTemplate
newBuilder, genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, nonEmpty, size, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, toString, stringPrefix, withFilter
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def companion : GenericCompanion[Iterable]
The factory companion object that builds instances of class CC
Overrides
Traversable.companion, GenericTraversableTemplate.companion