title: Convert map to HashMap and apply transforms
body: <p>I have a java map, <code>stringMap</code>, where the keys are strings that represent dates and the values are longs. I need to convert this map into a <code>collection.mutable.HashMap[DateTime, Long]</code> That is, in addition to changing the type of map, I need to change from Strings to DateTimes.</p>
  
  <p>This is the solution I am currently using:</p>
  
  <pre><code>import scala.collection.JavaConversions._
  val df = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
  val stringMap: java.util.HashMap[String, Long] = ...
  val dateTimeMap = stringMap map { case (k, v) =&gt; (df.parseDateTime(k), v)}
  val result = collection.mutable.HashMap[DateTime, Long](dateTimeMap.toArray:_*)
  </code></pre>
  
  <p>The last line comes from <a href="https://stackoverflow.com/questions/3074118/how-do-i-convert-a-mapint-any-to-a-sortedmap-in-scala-or-a-treemap">this post</a></p>
  
  <p>Note there is an implicit conversion converting stringMap to a scala Hashmap.</p>
  
  <p>The question is this, is there a better way to do this? I tried using a for yield / the map method with breakout, but they were returning a Map instead of a <code>collection.mutable.HashMap</code> EDIT: Apparently breakout does work.
  /EDIT</p>
  
  <p>Preferably there would be a functional programming way to do this without the need for a temporary <code>dateTimeMap</code></p>