I am trying to build a hashmap from pairs returned in a jdbc call using the following code
val query = "select x,y from tablename"
val rs = stmt.executeQuery(query)
var lookup = new HashMap[String,String]()
while(rs.next()) {
lookup = lookup + (rs.getString(1)-> rs.getString(2))
}
and getting a cast exception.
scala.collection.immutable.HashMap cannot be cast to scala.runtime.Nothing$
How might this be fixed and what is going on? Is there a better, more Scala like way to handle this like maybe something using a builder? Thanks for any help.