In this post, we will talk about manipulating files, specially reading files contents.
To read content of File:
In Ruby:
f=File.open "/bin/which"
f.each{|line| puts line}
f.close
In Java:
Stream<String> lines = Files.lines(Paths.get("/bin/which"));
lines.forEach(line -> System.out.println(line));
Very Similar!, Viva Java8
No comments:
Post a Comment