title: How to match value from scala Map
body: <p><br/>
  I am new to scala and was working with Maps. I do a get on Map, but I am not sure how to check for the return type and use it. <br/>
  I have following code which gives following compilation error "Pattern Type is incompatible with expected Type: TestClass.type required Option[TestClass].<br/></p>
  
  <pre><code>object MapOptionUsage extends App {
   val map : Map[Int, TestClass] = Map[Int, TestClass]() 
   var i = 0
   for(i &lt;- 0 to 5){
     map.put(i, createObj(i))
   }
   var a = map.get(5)
  
   a match {
       case TestClass =&gt; {//dosomething
      }
       case None =&gt; {//dosomething
      }
     }
     def createObj(i: Int): TestClass = {
       return new TestClass(i)
    }
  }
  case class TestClass(val id: Int)
  </code></pre>