title: Check if the key exist in scala Map
body: <p>I am very new to scala and I have simple <code>Map[String, String]</code>.</p>
  
  <p>Example map: </p>
  
  <pre><code>val map = Map("a" -&gt; "abc", "b" -&gt; "xyz")
  </code></pre>
  
  <p>I want to write a logic where if a particular key present in the map then call the encrypt() methods on the value and if the key is not present then return empty string.</p>
  
  <p>One way I can do this is:</p>
  
  <pre><code>encrypt(map.getOrElse(MARKETPLACE_ID.toString, ""))
  </code></pre>
  
  <p>This will fail incase of key is not present and encrypt() method will be called using empty string.</p>
  
  <p>Please help me to solve this in easiest way.</p>