File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -496,9 +496,9 @@ println(upper.getOrElse(""))</code></pre></td>
496
496
}</code ></pre >
497
497
<em ><strong >same as</strong ></em >
498
498
<pre class =" highlight " ><code >option match {
499
- case Some(x)
500
- if f.isDefinedAt(x) => ; ...
501
- case _ => ; None
499
+ case Some(x) if f.isDefinedAt(x) = & gt ; ...
500
+ case Some( _ ) => ; None
501
+ case None => ; None
502
502
}</code ></pre ></td >
503
503
<td >Apply partial pattern match on optional value.</td >
504
504
</tr >
@@ -596,17 +596,19 @@ println(upper.getOrElse(""))</code></pre></td>
596
596
<td ><pre class =" highlight " ><code >option.exists(f(_ ))</code ></pre >
597
597
<em ><strong >same as</strong ></em >
598
598
<pre class =" highlight " ><code >option match {
599
- case Some(x) => ; f(x)
600
- case None => ; false
599
+ case Some(x) if f(x) => ; true
600
+ case Some(_ ) => ; false
601
+ case None => ; false
601
602
}</code ></pre ></td >
602
603
<td >Apply predicate on optional value or <code >false</code > if empty.</td >
603
604
</tr >
604
605
<tr >
605
606
<td ><pre class =" highlight " ><code >option.forall(f(_ ))</code ></pre >
606
607
<em ><strong >same as</strong ></em >
607
608
<pre class =" highlight " ><code >option match {
608
- case Some(x) => ; f(x)
609
- case None => ; true
609
+ case Some(x) if f(x) => ; true
610
+ case Some(_ ) => ; false
611
+ case None => ; true
610
612
}</code ></pre ></td >
611
613
<td >Apply predicate on optional value or <code >true</code > if empty.</td >
612
614
</tr >
You can’t perform that action at this time.
0 commit comments