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.
1 parent 78d6be6 commit fb1f19aCopy full SHA for fb1f19a
src/main/scala/scala/Option.scala
@@ -333,6 +333,17 @@ sealed abstract class Option[+A] extends IterableOnce[A] with Product with Seria
333
@inline final def filterNot(p: A => Boolean): Option[A] =
334
if (isEmpty || !p(this.get)) this else None
335
336
+ /** Apply the side-effecting function $f to the option's value,
337
+ * if it is nonempty. Otherwise, do nothing.
338
+ *
339
+ * @param f a function to apply to the option's value
340
+ * @tparam U the return type of f
341
+ * @return this Option
342
+ */
343
+ @inline final def tapEach[U](f: A => U): Option[A] = {
344
+ foreach(f); this
345
+ }
346
+
347
/** Returns false if the option is $none, true otherwise.
348
*
349
* This is equivalent to:
0 commit comments