summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-05-20 14:41:51 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-05-20 14:41:51 +0200
commit1f4b9958e3bbd812e776b44cd8ba5322c16d4f25 (patch)
treef427ba7b3f3df46ac930d499e22f2920e1380f1f /src
parent2be2b5579a9cb07ea35558e5a01c5590141d8825 (diff)
parentd7aec58bf3dfbe57c29ad29e7035a6a351620423 (diff)
downloadscala-1f4b9958e3bbd812e776b44cd8ba5322c16d4f25.tar.gz
scala-1f4b9958e3bbd812e776b44cd8ba5322c16d4f25.tar.bz2
scala-1f4b9958e3bbd812e776b44cd8ba5322c16d4f25.zip
Merge pull request #3748 from retronym/ticket/8587
SI-8587 Explicitly document forall/exists for empty collections
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/TraversableLike.scala8
-rw-r--r--src/library/scala/collection/TraversableOnce.scala7
2 files changed, 7 insertions, 8 deletions
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index b60ea86ab0..d3a7db6968 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -345,8 +345,8 @@ trait TraversableLike[+A, +Repr] extends Any
* $mayNotTerminateInf
*
* @param p the predicate used to test elements.
- * @return `true` if the given predicate `p` holds for all elements
- * of this $coll, otherwise `false`.
+ * @return `true` if this $coll is empty, otherwise `true` if the given predicate `p`
+ * holds for all elements of this $coll, otherwise `false`.
*/
def forall(p: A => Boolean): Boolean = {
var result = true
@@ -362,8 +362,8 @@ trait TraversableLike[+A, +Repr] extends Any
* $mayNotTerminateInf
*
* @param p the predicate used to test elements.
- * @return `true` if the given predicate `p` holds for some of the
- * elements of this $coll, otherwise `false`.
+ * @return `false` if this $coll is empty, otherwise `true` if the given predicate `p`
+ * holds for some of the elements of this $coll, otherwise `false`
*/
def exists(p: A => Boolean): Boolean = {
var result = false
diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala
index 072fd3da44..a8c4e047ab 100644
--- a/src/library/scala/collection/TraversableOnce.scala
+++ b/src/library/scala/collection/TraversableOnce.scala
@@ -85,10 +85,9 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] {
*/
def seq: TraversableOnce[A]
- /** Presently these are abstract because the Traversable versions use
- * breakable/break, and I wasn't sure enough of how that's supposed to
- * function to consolidate them with the Iterator versions.
- */
+ // Presently these are abstract because the Traversable versions use
+ // breakable/break, and I wasn't sure enough of how that's supposed to
+ // function to consolidate them with the Iterator versions.
def forall(p: A => Boolean): Boolean
def exists(p: A => Boolean): Boolean
def find(p: A => Boolean): Option[A]