title: option[Any] pattern matching in Scala
body: <p>I've written the following code for finding the value corresponding to a key and returning it as Double. </p>
  
  <pre><code>def getDouble (key: String, map: HashMap[String, _]) : Double = {
      if (map contains key) {
          val o = map get key
          o match {
            case Some(i: Int) =&gt; return i.asInstanceOf[Int].toDouble;
            case Some(d: Double) =&gt; return d.asInstanceOf[Double];
            case Some(s: String) 
                =&gt; return  augmentString(s.asInstanceOf[String]).toDouble;
            case Some(int) =&gt; return o.asInstanceOf[Int].toDouble;
            case Some(double) =&gt; return o.asInstanceOf[Double].toDouble;
  
            case _ =&gt; return -1234567.00;
          }
      }
      else {
        return -1234567.00
      }
  }
  </code></pre>
  
  <p>What is the difference between <code>case Some(int)</code> and <code>case Some(i: Int)</code>?</p>
  
  <p>Do I need to use both <code>case Some(int)</code> and <code>case Some(i: Int)</code> for checking type int?</p>