Skip to content

Instantly share code, notes, and snippets.

@nelanka
Created February 11, 2015 18:18
Show Gist options
  • Save nelanka/40ae5e699acd7c9f8ed1 to your computer and use it in GitHub Desktop.
Save nelanka/40ae5e699acd7c9f8ed1 to your computer and use it in GitHub Desktop.
Scala I/O
for (ln <- io.Source.stdin.getLines()) println(ln)
Iterator.continually(StdIn.readLine()).takeWhile(_.nonEmpty).foreach(line => println("read " + line))
Observable.from(Iterator.continually(StdIn.readLine()).toIterable).subscribe(line => println("read " + line))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment