This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<String> readListStringsFromCSVFile(String filePath) throws IOException { | |
List<String> fileEntries = new ArrayList<>(); | |
BufferedReader br = new BufferedReader(new FileReader(filePath)); | |
String line; | |
while ((line = br.readLine()) != null) { | |
fileEntries.add(line); | |
} | |
return fileEntries; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<String> readListStringsFromCSVFile(String filePath) throws IOException { | |
return Files.lines(Paths.get(filePath)).collect(Collectors.toList()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<String> readListStringsFromCSVFile(String filePath) throws IOException { | |
return Files.lines(Paths.get(filePath)).collect(Collectors.toList()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper function to append values if not already present in the Map | |
protected void appendMapEntries(Map<String, List<String>> map, String key, List<String> values) { | |
for (String value : values) { | |
List<String> existingValues = map.get(key); | |
if (existingValues == null) { | |
existingValues = new ArrayList<String>(); | |
map.put(key, existingValues); | |
} | |
else { | |
existingValues.add(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper function to append values if not already present in the Map | |
protected void appendMapEntries(Map<String, List<String>> map, String key, List<String> values) { | |
values.forEach(value -> map.computeIfAbsent(key, k -> new ArrayList<>()).add(value)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
class Main { | |
public static void main(String[] args) { | |
try { | |
Scanner scanner = new Scanner(System.in); | |
scanner.nextInt(); | |
} catch (Exception e) { | |
System.out.println("enter an int"); | |
} finally { |