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