We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 503dc14 + f4f3fb6 commit 0f07cc1Copy full SHA for 0f07cc1
src/library/scala/Option.scala
@@ -73,6 +73,19 @@ object Option {
73
* }
74
* }}}
75
*
76
+ * Interacting with code that can occasionally return null can be
77
+ * safely wrapped in $option to become $none and $some otherwise. {{{
78
+ * val abc = new java.util.HashMap[Int, String]
79
+ * abc.put(1, "A")
80
+ * bMaybe = Option(abc.get(2))
81
+ * bMaybe match {
82
+ * case Some(b) =>
83
+ * println(s"Found $b")
84
+ * case None =>
85
+ * println("Not found")
86
+ * }
87
+ * }}}
88
+ *
89
* @note Many of the methods in here are duplicative with those
90
* in the Traversable hierarchy, but they are duplicated for a reason:
91
* the implicit conversion tends to leave one with an Iterable in
0 commit comments