title: Scala HashSet or HashMap to implement a cache of Strings?
body: <p>In my current code I see a lot of String IDs cached as:</p>
  
  <pre><code>val idMapping = MMap.empty[String, String]
  idMapping.put("ID1234", "ID1234")
  </code></pre>
  
  <p>This is supposedly done as a performant way of caching these unique ID for quick retrieval like -</p>
  
  <pre><code>idMapping.get("ID1234")
  </code></pre>
  
  <p>and If it returns null then blah blah.</p>
  
  <p>Is there a better alternative to this? HashSet comes to my mind readily but I find scant HashSet based cache examples in Scala? </p>
  
  <p>Can anybody suggest improvements to the above design?</p>