diff options
author | jxcoder <jxcoder@ya.ru> | 2014-07-03 17:16:58 +0700 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2014-08-11 17:55:03 +0200 |
commit | 1c96ed5a7b5c14c0fed3f9480c4e0fbe9be2b80f (patch) | |
tree | 68978c051b80fef55c370e44b9e143dde309a11a /src/library | |
parent | f18db59d5c580e4df1ad6bc0fe1206cc00dbce9d (diff) | |
download | scala-1c96ed5a7b5c14c0fed3f9480c4e0fbe9be2b80f.tar.gz scala-1c96ed5a7b5c14c0fed3f9480c4e0fbe9be2b80f.tar.bz2 scala-1c96ed5a7b5c14c0fed3f9480c4e0fbe9be2b80f.zip |
[backport] SI-8705 Added example to Option.contains method.
(cherry picked from commit 1e2a21681a4a55469faa59b07473a3b269e70258)
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Option.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala index 5a1c832fae..9371775d67 100644 --- a/src/library/scala/Option.scala +++ b/src/library/scala/Option.scala @@ -211,6 +211,17 @@ sealed abstract class Option[+A] extends Product with Serializable { /** Tests whether the option contains a given value as an element. * + * @example {{{ + * // Returns true because Some instance contains string "something" which equals "something". + * Some("something") contains "something" + * + * // Returns false because "something" != "anything". + * Some("something") contains "anything" + * + * // Returns false when method called on None. + * None contains "anything" + * }}} + * * @param elem the element to test. * @return `true` if the option has an element that is equal (as * determined by `==`) to `elem`, `false` otherwise. |