diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-21 11:12:01 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-21 12:45:13 +0200 |
commit | acf4ece0c61acaa564954e5e617cd2c0a5bca186 (patch) | |
tree | 3970428f1e6a0838d0e428d0f20ba0942dbfd128 /dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer | |
parent | 79e04705c6eeed95992e5753a8328aad90e02f68 (diff) |
use function GraphAlgorithms.loadStrings()
Diffstat (limited to 'dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer')
-rw-r--r-- | dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/model/Combi.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/model/Combi.java b/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/model/Combi.java index 6757563..a2da9f2 100644 --- a/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/model/Combi.java +++ b/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/model/Combi.java @@ -3,12 +3,10 @@ package dk.abcdefghijklmnopqrstuvxyzæøå.bachelorizer.model; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.io.IOException; import java.util.List; +import com.example.portfolio3.GraphAlgorithms; + /// Combi - static sample dataset of course combinations /// /// Slurps and parses data from upstream-provided comma-separated file. @@ -20,11 +18,10 @@ public final class Combi { /// Default constructor /// /// @param path path to data file - private Combi(final Path path) { + private Combi(final String path) { - try { // slurp all content at once - List<String> lines = Files.readAllLines(path); + List<String> lines = GraphAlgorithms.loadStrings(path); for (String line : lines) { String[] values = line.split(","); @@ -34,10 +31,6 @@ public final class Combi { } System.out.println(); } - - } catch (IOException e) { - e.printStackTrace(); - } } /// JVM entry point @@ -47,10 +40,10 @@ public final class Combi { // first argument, if provided, is the data file path; // else use upstream named file in current directory. - Path path = (args.length > 0) - ? Paths.get(args[0]) - : Paths.get("combi.txt"); + String path = (args.length > 0) + ? args[0] + : "combi.txt"; - new Combi(path); + Combi combi = new Combi(path); } } |