@Test public void should_not_detect_first_line_as_column() { List<String> list = Arrays.asList("\"1000800\",\"2.0 PET X8 LIFT SOUR CHERRY\"", "\"1001000\",\"1.0 RGB X12 COCA COLA\"", "\"1001300\",\"2.0 PET X6 LILIA\""); Separator separator = new Separator(','); separator.incrementCount(1); separator.incrementCount(2); separator.incrementCount(3); CSVFastHeaderAndTypeAnalyzer analysis = new CSVFastHeaderAndTypeAnalyzer(list, separator); List<String> expectedHeaders = Arrays.asList("COL1", "COL2"); Assert.assertArrayEquals(expectedHeaders.toArray(), analysis.getHeaders().stream().map(p -> p.getKey()).toArray()); }
public List<Pair<String, Type>> getHeaders() { if (!analysisPerformed) { analyze(); } return headers; }
CSVFastHeaderAndTypeAnalyzer { public List<Pair<String, Type>> getHeaders() { if (!analysisPerformed) { analyze(); } return headers; } }
CSVFastHeaderAndTypeAnalyzer { public List<Pair<String, Type>> getHeaders() { if (!analysisPerformed) { analyze(); } return headers; } CSVFastHeaderAndTypeAnalyzer(List<String> sampleLines, Separator separator); }
CSVFastHeaderAndTypeAnalyzer { public List<Pair<String, Type>> getHeaders() { if (!analysisPerformed) { analyze(); } return headers; } CSVFastHeaderAndTypeAnalyzer(List<String> sampleLines, Separator separator); void analyze(); boolean isFirstLineAHeader(); List<Pair<String, Type>> getHeaders(); boolean isHeaderInfoReliable(); }
CSVFastHeaderAndTypeAnalyzer { public List<Pair<String, Type>> getHeaders() { if (!analysisPerformed) { analyze(); } return headers; } CSVFastHeaderAndTypeAnalyzer(List<String> sampleLines, Separator separator); void analyze(); boolean isFirstLineAHeader(); List<Pair<String, Type>> getHeaders(); boolean isHeaderInfoReliable();  }