Exemplo n.º 1
0
 @Override
 public void run() throws Exception {
   Path inputFile =
       Paths.get(AdventOfCode.VAR_PATH, DAY_PATH, INPUT_FILE)
           .toRealPath(LinkOption.NOFOLLOW_LINKS);
   try (BufferedReader reader = Files.newBufferedReader(inputFile)) {
     String line;
     int wrapper = 0, ribbon = 0;
     while ((line = reader.readLine()) != null) {
       Dimensions dims = parseLine(line);
       wrapper += dims.getWrapper();
       ribbon += dims.getRibbon();
     }
     System.out.println("Wrapper: " + wrapper);
     System.out.println("Ribbon: " + ribbon);
   } catch (IOException x) {
     System.err.format("IOException: %s%n", x);
   }
 }