adam bien's blog

Counting Lines With Java 8 📎


import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

Path path = Paths.get("./readme.txt");
long lineCount = Files.lines(path).count();

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting