object Main {
  def main(args: Array[String]): Unit = {
    val file = new java.io.PrintWriter("out/output_library_sort")
    var source = scala.io.Source.fromFile("out/testdata")
    source.getLines.toSeq.sorted.foreach(file.println)
    source.close()
    file.close()
  }
}

object Main {
  def main(args: Array[String]): Unit = {
    val file = new java.io.PrintWriter("out/output_library_sort")
    var source = scala.io.Source.fromFile("out/testdata")
    source.getLines.map(_.toInt).toSeq.sorted.foreach(x => file.println(f"${x}%07d"))
    source.close()
    file.close()
  }
}

Convert from String to Int before sorting
Convert from String to Int before sorting
