Author: Nicholas Prado <nmprado@nzen.ws>
Date: Fri Dec 3 02:49:13 UTC 2021
Parent: dd27f4eca2f4decabacd8240a78c0e1a4e48e7fc
Log message:
chore 21 template for simplicity
Rather than continue to hack a fresh class from the previous example,
this adds the typical template that I start with.
1: diff --git a/src/java/Template.java b/src/java/Template.java
2: new file mode 100644
3: index 0000000..e79a067
4: --- /dev/null
5: +++ b/src/java/Template.java
6: @@ -0,0 +1,75 @@
7: +
8: +import java.io.IOException;
9: +import java.nio.file.*;
10: +import java.util.*;
11: +
12: +public class Exercise21001
13: +{
14: +
15: + public static void main(
16: + String args[]
17: + ) {
18: + final String here = "e21001.m ";
19: + if ( args.length < 1 )
20: + {
21: + throw new RuntimeException( here +"add a filename argument" );
22: + }
23: + String userSaysFile = args[ 0 ];
24: + List<String> fileLines = new LinkedList<>();
25: + try
26: + {
27: + Path where = Paths.get( userSaysFile );
28: + fileLines = Files.readAllLines( where );
29: + }
30: + catch ( IOException | InvalidPathException ie )
31: + {
32: + System.err.println( here +"couldn't read file "+ userSaysFile +" because "+ ie );
33: + return;
34: + }
35: + /*
36: + - interpretation of spec -
37: + */
38: + Exercise21001.( fileLines );
39: + }
40: +
41: +
42: + private static void (
43: + List<String> fileLines
44: + ) {
45: + for ( String line : fileLines )
46: + {
47: + if ( line.isEmpty() )
48: + continue;
49: + }
50: + System.out.println( );
51: + }
52: +
53: +
54: +}
55: +
56: +
57: +
58: +
59: +
60: +
61: +
62: +
63: +
64: +
65: +
66: +
67: +
68: +
69: +
70: +
71: +
72: +
73: +
74: +
75: +
76: +
77: +
78: +
79: +
80: +
81: +