@Test public void testGetCsvDataMap() throws IOException { Map<String, String> expectedDataMap = dataList.stream().collect(Collectors.toMap(data -> data[0], data -> data[1])); Map<String, String> actualDataMap = CsvFiles.getCsvDataMap(csvStringFile.getPath(), headerPresent); assertEquals(expectedDataMap, actualDataMap); }
public static Map<String, String> getCsvDataMap(String fileName, final int key, final int value, boolean headerPresent) throws IOException { final Map<String, String> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader((header, line, lineNumber) -> result.put(line[key], line[value])); return result; }
CsvFiles { public static Map<String, String> getCsvDataMap(String fileName, final int key, final int value, boolean headerPresent) throws IOException { final Map<String, String> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader((header, line, lineNumber) -> result.put(line[key], line[value])); return result; } }
CsvFiles { public static Map<String, String> getCsvDataMap(String fileName, final int key, final int value, boolean headerPresent) throws IOException { final Map<String, String> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader((header, line, lineNumber) -> result.put(line[key], line[value])); return result; } private  CsvFiles(); }
CsvFiles { public static Map<String, String> getCsvDataMap(String fileName, final int key, final int value, boolean headerPresent) throws IOException { final Map<String, String> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader((header, line, lineNumber) -> result.put(line[key], line[value])); return result; } private  CsvFiles(); static Map<String, String> getCsvDataMap(String fileName,
      final int key, final int value, boolean headerPresent); static Map<String, String> getCsvDataMap(String fileName, boolean headerPresent); static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent); static List<Map<String, String>> getCsvDataListMap(String fileName,
      boolean headerPresent); static List<String> getCsvDataByColumn(String fileName, final int column,
      boolean headerPresent); static List<String[]> getCsvDataArray(String fileName, boolean headerPresent); static List<String[]> getCsvDataArray(Reader csvReader, boolean headerPresent); static void writeCsv(List<String[]> csvData, String fileName); }
CsvFiles { public static Map<String, String> getCsvDataMap(String fileName, final int key, final int value, boolean headerPresent) throws IOException { final Map<String, String> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader((header, line, lineNumber) -> result.put(line[key], line[value])); return result; } private  CsvFiles(); static Map<String, String> getCsvDataMap(String fileName,
      final int key, final int value, boolean headerPresent); static Map<String, String> getCsvDataMap(String fileName, boolean headerPresent); static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent); static List<Map<String, String>> getCsvDataListMap(String fileName,
      boolean headerPresent); static List<String> getCsvDataByColumn(String fileName, final int column,
      boolean headerPresent); static List<String[]> getCsvDataArray(String fileName, boolean headerPresent); static List<String[]> getCsvDataArray(Reader csvReader, boolean headerPresent); static void writeCsv(List<String[]> csvData, String fileName);  }