diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-04-14 16:09:33 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-04-14 16:09:33 +0000 |
commit | 09e192caea0fe2b8afaed96a7077e8cf52af2345 (patch) | |
tree | 356cb0692eefc6703502339d271e7bcda9a437f1 /src/library/scala/collection/IterableLike.scala | |
parent | 09028a4fa5cf66a98080baa26cdadba29314c640 (diff) | |
download | scala-09e192caea0fe2b8afaed96a7077e8cf52af2345.tar.gz scala-09e192caea0fe2b8afaed96a7077e8cf52af2345.tar.bz2 scala-09e192caea0fe2b8afaed96a7077e8cf52af2345.zip |
Adding some docs refactorings.
Also, added some docs variables to Gen* traits that were missing.
No review.
Diffstat (limited to 'src/library/scala/collection/IterableLike.scala')
-rw-r--r-- | src/library/scala/collection/IterableLike.scala | 101 |
1 files changed, 2 insertions, 99 deletions
diff --git a/src/library/scala/collection/IterableLike.scala b/src/library/scala/collection/IterableLike.scala index 4d10f31920..fe87d1a6d9 100644 --- a/src/library/scala/collection/IterableLike.scala +++ b/src/library/scala/collection/IterableLike.scala @@ -8,10 +8,12 @@ package scala.collection + import generic._ import immutable.{ List, Stream } import annotation.unchecked.uncheckedVariance + /** A template trait for iterable collections of type `Iterable[A]`. * $iterableInfo * @define iterableInfo @@ -46,14 +48,6 @@ import annotation.unchecked.uncheckedVariance * * @define Coll Iterable * @define coll iterable collection - * @define zipthatinfo 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. - * @define zipbfinfo 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)`. */ trait IterableLike[+A, +Repr] extends Equals with TraversableLike[A, Repr] with GenIterableLike[A, Repr] { self => @@ -194,30 +188,6 @@ self => } } - /** Returns a $coll formed from this $coll 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. - * - * $orderDependent - * - * @param that The iterable providing the second half of each result pair - * @tparam A1 the type of the first half of the returned pairs (this is always a supertype - * of the collection's element type `A`). - * @tparam B the type of the second half of the returned pairs - * @tparam That $zipthatinfo - * @param bf $zipbfinfo - * @return a new collection of type `That` containing pairs consisting of - * corresponding elements of this $coll and `that`. The length - * of the returned collection is the minimum of the lengths of this $coll and `that`. - * - * @usecase def zip[B](that: Iterable[B]): $Coll[(A, B)] - * - * @param that The iterable providing the second half of each result pair - * @tparam B the type of the second half of the returned pairs - * @return a new $coll containing pairs consisting of - * corresponding elements of this $coll and `that`. The length - * of the returned collection is the minimum of the lengths of this $coll and `that`. - */ def zip[A1 >: A, B, That](that: GenIterable[B])(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That = { val b = bf(repr) val these = this.iterator @@ -227,34 +197,6 @@ self => b.result } - /** Returns a $coll formed from this $coll 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. - * - * $orderDependent - * - * @param that the iterable providing the second half of each result pair - * @param thisElem the element to be used to fill up the result if this $coll is shorter than `that`. - * @param thatElem the element to be used to fill up the result if `that` is shorter than this $coll. - * @return a new collection of type `That` containing pairs consisting of - * corresponding elements of this $coll and `that`. The length - * of the returned collection is the maximum of the lengths of this $coll and `that`. - * If this $coll is shorter than `that`, `thisElem` values are used to pad the result. - * If `that` is shorter than this $coll, `thatElem` values are used to pad the result. - * - * @usecase def zipAll[B](that: Iterable[B], thisElem: A, thatElem: B): $Coll[(A, B)] - * - * @param that The iterable providing the second half of each result pair - * @param thisElem the element to be used to fill up the result if this $coll is shorter than `that`. - * @param thatElem the element to be used to fill up the result if `that` is shorter than this $coll. - * @tparam B the type of the second half of the returned pairs - * @return a new $coll containing pairs consisting of - * corresponding elements of this $coll and `that`. The length - * of the returned collection is the maximum of the lengths of this $coll and `that`. - * If this $coll is shorter than `that`, `thisElem` values are used to pad the result. - * If `that` is shorter than this $coll, `thatElem` values are used to pad the result. - */ def zipAll[B, A1 >: A, That](that: GenIterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That = { val b = bf(repr) val these = this.iterator @@ -268,31 +210,6 @@ self => b.result } - /** Zips this $coll with its indices. - * - * $orderDependent - * - * @tparam A1 the type of the first half of the returned pairs (this is always a supertype - * of the collection's element type `A`). - * @tparam 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. - * @tparam 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, Int)`. - * @return A new collection of type `That` containing pairs consisting of all elements of this - * $coll paired with their index. Indices start at `0`. - * - * @usecase def zipWithIndex: $Coll[(A, Int)] - * - * @return A new $coll containing pairs consisting of all elements of this - * $coll paired with their index. Indices start at `0`. - * @example - * `List("a", "b", "c").zipWithIndex = List(("a", 0), ("b", 1), ("c", 2))` - * - */ def zipWithIndex[A1 >: A, That](implicit bf: CanBuildFrom[Repr, (A1, Int), That]): That = { val b = bf(repr) var i = 0 @@ -303,20 +220,6 @@ self => b.result } - /** Checks if the other iterable collection contains the same elements in the same order as this $coll. - * - * $orderDependent - * $willNotTerminateInf - * - * @param that the collection to compare with. - * @tparam B the type of the elements of collection `that`. - * @return `true`, if both collections contain the same elements in the same order, `false` otherwise. - * - * @usecase def sameElements(that: Iterable[A]): Boolean - * - * @param that the collection to compare with. - * @return `true`, if both collections contain the same elements in the same order, `false` otherwise. - */ def sameElements[B >: A](that: GenIterable[B]): Boolean = { val these = this.iterator val those = that.iterator |