+ public static Collection<String> readDistinctValuesOfColumn(Path source, char delim, int mappingIndex) throws IOException {
+ Set<String> results = new HashSet<>();
+ CSVFormat format = CSVFormat.newFormat(delim);
+ try (CSVParser parser = format.parse(Files.newBufferedReader(source))) {
+ Iterator<CSVRecord> records = parser.iterator();
+ if (records.hasNext())
+ records.next();
+ while (records.hasNext()) {
+ CSVRecord row = records.next();
+ String value = row.get(mappingIndex);
+ results.add(value);
+ }
+ }
+ return results;
+ }
+