Change to use scala.collection.mutable.{HashMap,HashSet} instead of Java's collection.