Avoid Abbreviations

 class​ Logbook {
»static​ ​final​ Path DIR = Paths.get(​"/var/log"​);
 static​ ​final​ Path CSV = DIR.resolve(​"stats.csv"​);
 static​ ​final​ String GLOB = ​"*.log"​;
 
»void​ createStats() ​throws​ IOException {
 try​ (DirectoryStream<Path> dirStr =
  Files.newDirectoryStream(DIR, GLOB);
  BufferedWriter bufW = Files.newBufferedWriter(CSV)) {
 for​ (Path lFile : dirStr) {
  String csvLn = String.format(​"%s,%d,%s"​,
  lFile,
  Files.size(lFile),
  Files.getLastModifiedTime(lFile));
  bufW.write(csvLn);
  bufW.newLine();
  }
  }
  }
 }

Abbreviations are one step up from single-letter names, and our world is full of them: ASAP, FYI, TGIF, AFK, NASA, FBI, CYA, NYPD, and so on. Many programmers like to create their ...

Get Java By Comparison now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.