walk
method of the class Files class to traverse the directory tree, and the lines
method to read the lines of a file.
LineType
for the different kinds of lines and use the following helper function to classify them:
private static LineType classify(String line) { line = line.trim(); if (line.isEmpty()) return LineType.EMPTY; if (line.startsWith("//")) return LineType.COMMENT; if (line.startsWith("@")) return LineType.ANNOTATION; return LineType.CODE; }