diff options
author | Daniel C. Sobral <dcsobral@gmail.com> | 2011-12-02 18:46:44 -0200 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-04 14:51:23 -0800 |
commit | ddff6ac6a68e139a34e94da6844a090ac1db754c (patch) | |
tree | aece8679e09fbca401642f111dbf3f824f6efb61 /src/library | |
parent | 7adb4784bf484f8cf57b5edb612d2c4f34388237 (diff) | |
download | scala-ddff6ac6a68e139a34e94da6844a090ac1db754c.tar.gz scala-ddff6ac6a68e139a34e94da6844a090ac1db754c.tar.bz2 scala-ddff6ac6a68e139a34e94da6844a090ac1db754c.zip |
Add a mnemonic to help remember what's the difference between +:
and :+, plus one for ++:.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/GenSeqLike.scala | 4 | ||||
-rw-r--r-- | src/library/scala/collection/TraversableLike.scala | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/library/scala/collection/GenSeqLike.scala b/src/library/scala/collection/GenSeqLike.scala index b3dd4764a9..63e9543711 100644 --- a/src/library/scala/collection/GenSeqLike.scala +++ b/src/library/scala/collection/GenSeqLike.scala @@ -276,6 +276,8 @@ trait GenSeqLike[+A, +Repr] extends GenIterableLike[A, Repr] with Equals with Pa /** A copy of the $coll with an element prepended. * * Note that :-ending operators are right associative (see example). + * A mnemonic for `+:` vs. `:+` is: the COLon goes on the COLlection side. + * * Also, the original $coll is not modified, so you will want to capture the result. * * Example: @@ -304,6 +306,8 @@ trait GenSeqLike[+A, +Repr] extends GenIterableLike[A, Repr] with Equals with Pa /** A copy of this $coll with an element appended. * + * A mnemonic for `+:` vs. `:+` is: the COLon goes on the COLlection side. + * * $willNotTerminateInf * @param elem the appended element * @tparam B the element type of the returned $coll. diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala index 6fa05bd85b..4f0fec1de3 100644 --- a/src/library/scala/collection/TraversableLike.scala +++ b/src/library/scala/collection/TraversableLike.scala @@ -159,8 +159,10 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] /** As with `++`, returns a new collection containing the elements from the left operand followed by the * elements from the right operand. + * * It differs from `++` in that the right operand determines the type of * the resulting collection rather than the left one. + * Mnemonic: the COLon is on the side of the new COLlection type. * * Example: * {{{ @@ -195,8 +197,10 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] /** As with `++`, returns a new collection containing the elements from the * left operand followed by the elements from the right operand. + * * It differs from `++` in that the right operand determines the type of * the resulting collection rather than the left one. + * Mnemonic: the COLon is on the side of the new COLlection type. * * Example: * {{{ |