What is the advantage of using Option.map over Option.isEmpty and Option.get?
<p>I am a new to Scala coming from Java background, currently confused about the best practice considering <code>Option[T]</code>.</p>

<p>I feel like using <code>Option.map</code> is just more functional and beautiful, but this is not a good argument to convince other people. Sometimes, isEmpty check feels more straight forward thus more readable. Is there any objective advantages, or is it just personal preference?</p>

<p>Example:</p>

<p>Variation 1:</p>

<pre><code>someOption.map{ value =&gt; 
  {
    //some lines of code
  }
} orElse(foo)
</code></pre>

<p>Variation 2:</p>

<pre><code>if(someOption.isEmpty){
  foo
} else{
  val value = someOption.get
  //some lines of code
}
</code></pre>

<p>I intentionally excluded the options to use <code>fold</code> or pattern matching. I am simply not pleased by the idea of treating <code>Option</code> as a collection right now, and using pattern matching for a simple <code>isEmpty</code> check is an abuse of pattern matching IMHO. But no matter why I dislike these options, I want to keep the scope of this question to be the above two variations as named in the title. </p>