summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/GenTraversableLike.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-07-29 23:58:45 +0000
committerPaul Phillips <paulp@improving.org>2011-07-29 23:58:45 +0000
commit67a63278a6c4e9347792219086f11a87d177eee7 (patch)
tree411bab57bbcd9f408ee4230420a7897de952f58b /src/library/scala/collection/GenTraversableLike.scala
parentaf412cd72e6e35e7c76ee24e9fa65b73293f0082 (diff)
downloadscala-67a63278a6c4e9347792219086f11a87d177eee7.tar.gz
scala-67a63278a6c4e9347792219086f11a87d177eee7.tar.bz2
scala-67a63278a6c4e9347792219086f11a87d177eee7.zip
- Update Scaladoc for LinkedList and for some o...
- Update Scaladoc for LinkedList and for some of the functions/operators - that it inherits. Completed Scaladoc for append Added example - in GenSeqLike for apply. Added $collectExample to collect in - GenTraversableLike and supplied an actual example in LinkedList Contributed by Donald McLean.
Diffstat (limited to 'src/library/scala/collection/GenTraversableLike.scala')
-rw-r--r--src/library/scala/collection/GenTraversableLike.scala25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/library/scala/collection/GenTraversableLike.scala b/src/library/scala/collection/GenTraversableLike.scala
index fbb8b96ba4..dc89bcf85d 100644
--- a/src/library/scala/collection/GenTraversableLike.scala
+++ b/src/library/scala/collection/GenTraversableLike.scala
@@ -45,6 +45,7 @@ import annotation.migration
*
* @define Coll GenTraversable
* @define coll general collection
+ * @define collectExample
* @tparam A the collection element type.
* @tparam Repr the actual type of the element container.
*
@@ -160,6 +161,8 @@ trait GenTraversableLike[+A, +Repr] extends GenTraversableOnce[A] with Paralleli
/** Builds a new collection by applying a partial function to all elements of this $coll
* on which the function is defined.
*
+ * $collectExample
+ *
* @param pf the partial function which filters and maps the $coll.
* @tparam B the element type of the returned collection.
* @tparam That $thatinfo
@@ -193,7 +196,27 @@ trait GenTraversableLike[+A, +Repr] extends GenTraversableOnce[A] with Paralleli
*/
def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That
- /** Concatenates this $coll with the elements of a traversable collection.
+ /** Returns a new $coll containing the elements from the left hand operand followed by the elements from the
+ * right hand operand. The element type of the $coll is the most specific superclass encompassing
+ * the element types of the two operands (see example).
+ *
+ * Example:
+ * {{{
+ * scala> val a = LinkedList(1)
+ * a: scala.collection.mutable.LinkedList[Int] = LinkedList(1)
+ *
+ * scala> val b = LinkedList(2)
+ * b: scala.collection.mutable.LinkedList[Int] = LinkedList(2)
+ *
+ * scala> val c = a ++ b
+ * c: scala.collection.mutable.LinkedList[Int] = LinkedList(1, 2)
+ *
+ * scala> val d = LinkedList('a')
+ * d: scala.collection.mutable.LinkedList[Char] = LinkedList(a)
+ *
+ * scala> val e = c ++ d
+ * e: scala.collection.mutable.LinkedList[AnyVal] = LinkedList(1, 2, a)
+ * }}}
*
* @param that the traversable to append.
* @tparam B the element type of the returned collection.