の続き。なんとなく。startsWithとかmapなどを使ってみたかった。使ってみたかっただけ。
scala> val a = "diff a.txt b.txt".lineStream_! a: Stream[String] = Stream(1c1, ?) scala> a res3: Stream[String] = Stream(1c1, ?) scala> a.toList res4: List[String] = List(1c1, < ddd, ---, > ccc, 11158292d11158291, < eee) scala> a.filter(x => x startsWith "<") res5: scala.collection.immutable.Stream[String] = Stream(< ddd, ?) scala> a.filter(x => x startsWith "<").toList res6: List[String] = List(< ddd, < eee) scala> a.filter(x => x startsWith "<").map(x => x.replaceAll("< ", "")).toList res7: List[String] = List(ddd, eee) scala> val a = "diff --suppress-common-lines -y a.txt b.txt".lineStream_! a: Stream[String] = Stream(ddd | ccc, ?)