title: Scala map to HashMap
body: <p>Given a <code>List</code> of <code>Person</code> objects of this class:</p>
  
  <p><code>class Person(val id : Long, val name : String)</code></p>
  
  <p>What would be the "scala way" of obtaining a (java) HashMap with <code>id</code> for keys and <code>name</code> for values?</p>
  
  <p>If the best answer does not include using <code>.map</code>, please provide an example with it, even if it's harder to do.</p>
  
  <p>Thank you.</p>
  
  <h2>EDIT</h2>
  
  <p>This is what I have right now, but it's not too immutable:</p>
  
  <pre><code>val map = new HashMap[Long, String]
  personList.foreach { p =&gt; map.put(p.getId, p.getName) }
  
  return map
  </code></pre>