Comment detail

ファイル内の重複行削除(後優先) (Nested Flatten)
getLinesで返ってくるのはイテレータです。
念のため。
1
2
3
4
5
6
import scala.collection.mutable.LinkedHashSet
import scala.io.Source.fromFile

(new LinkedHashSet[String] /: fromFile("test.txt").getLines){(set,line) =>
  set -= line; set += line; set
}.foreach(print)

Index

Feed

Other

Link

Pathtraq

loading...