Finish converting Java to Scala.