summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/IterableLike.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/IterableLike.scala')
-rw-r--r--src/library/scala/collection/IterableLike.scala20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/library/scala/collection/IterableLike.scala b/src/library/scala/collection/IterableLike.scala
index d5e1dd53db..91ab1f6ac2 100644
--- a/src/library/scala/collection/IterableLike.scala
+++ b/src/library/scala/collection/IterableLike.scala
@@ -83,10 +83,26 @@ self =>
iterator.foldRight(z)(op)
override /*TraversableLike*/ def reduceRight[B >: A](op: (A, B) => B): B =
iterator.reduceRight(op)
+
+
+ /** Returns this $coll as an iterable collection.
+ *
+ * A new collection will not be built; lazy collections will stay lazy.
+ *
+ * $willNotTerminateInf
+ * @return an `Iterable` containing all elements of this $coll.
+ */
override /*TraversableLike*/ def toIterable: Iterable[A] =
thisCollection
- override /*TraversableLike*/ def toIterator: Iterator[A] =
- iterator
+
+ /** Returns an Iterator over the elements in this $coll. Produces the same
+ * result as `iterator`.
+ * $willNotTerminateInf
+ * @return an Iterator containing all elements of this $coll.
+ */
+ @deprecatedOverriding("toIterator should stay consistent with iterator for all Iterables: override iterator instead.", "2.11.0")
+ override def toIterator: Iterator[A] = iterator
+
override /*TraversableLike*/ def head: A =
iterator.next()