feat: add argument for file

This commit is contained in:
Anthony Berg 2024-10-17 18:56:26 +02:00
parent cfe6a78750
commit 5d5c295ac4

View File

@ -6,16 +6,15 @@ public class Main {
// Get commandline arguments // Get commandline arguments
// Checks that only the file has been declared // Checks that only the file has been declared
// TODO Add arguments to read files from if (args.length != 1) {
// if (args.length != 1) { System.out.println("Invalid arguments, you need to define the text file to read from!");
// System.out.println("Invalid arguments, you need to define the text file to read from!"); return;
// return; }
// }
// Path filePath = Path.of(args[0]);
// System.out.println(Arrays.toString(args));
// Get the data from the file // Get the data from the file
List<String> data = ReadFile.open(Path.of("example.txt")); List<String> data = ReadFile.open(filePath);
// Gets a map with the total occurrences for each domain // Gets a map with the total occurrences for each domain
Map<String, Integer> domains = getDomainTotal(data); Map<String, Integer> domains = getDomainTotal(data);