class ScalaWordSort(fileName:String){
lazy val sortedWords = {
Source.fromFile(dataFile).getLines.foreach(_.split(" ").foreach(words ::= _))
words.sort(_.toLowerCase < _.toLowerCase)
}
private
val dataFile = new File(fileName)
var words:List[String] = Nil
}
Wednesday, May 20, 2009
JavaOne Talk: Scala Word Sort
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment