@Test public void testGetCsvDataMapArray() throws IOException { Map<String, String[]> actualDataMapArray = CsvFiles.getCsvDataMapArray(csvStringFile.getPath(), headerPresent); Map<String, List<String>> actualDataMapList = Maps.newHashMap(); for (Entry<String, String[]> actualDataMapEntry : actualDataMapArray.entrySet()) { actualDataMapList.put( actualDataMapEntry.getKey(), Arrays.asList(actualDataMapEntry.getValue())); } Map<String, List<String>> expectedDataMap = dataList .stream() .collect( Collectors.toMap( rowData -> rowData[0], rowData -> Arrays.asList(Arrays.copyOfRange(rowData, 1, rowData.length)))); assertEquals(expectedDataMap, actualDataMapList); }
public static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent) throws IOException { final Map<String, String[]> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader( (header, line, lineNumber) -> result.put( line[0], Arrays.asList(line) .subList(1, line.length) .toArray(new String[line.length - 1]))); return result; }
CsvFiles { public static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent) throws IOException { final Map<String, String[]> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader( (header, line, lineNumber) -> result.put( line[0], Arrays.asList(line) .subList(1, line.length) .toArray(new String[line.length - 1]))); return result; } }
CsvFiles { public static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent) throws IOException { final Map<String, String[]> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader( (header, line, lineNumber) -> result.put( line[0], Arrays.asList(line) .subList(1, line.length) .toArray(new String[line.length - 1]))); return result; } private  CsvFiles(); }
CsvFiles { public static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent) throws IOException { final Map<String, String[]> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader( (header, line, lineNumber) -> result.put( line[0], Arrays.asList(line) .subList(1, line.length) .toArray(new String[line.length - 1]))); 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[]> getCsvDataMapArray(String fileName, boolean headerPresent) throws IOException { final Map<String, String[]> result = Maps.newHashMap(); new CsvReader(fileName, headerPresent) .processReader( (header, line, lineNumber) -> result.put( line[0], Arrays.asList(line) .subList(1, line.length) .toArray(new String[line.length - 1]))); 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);  }