@Test public void mergeComplementaryColumnsThatNeedsMultiplePasses() { DataTable dt = new DataTable(1); dt.addRow("H1", " ", "H2", " ", "H4"); dt.addRow("A1", "B1", " ", "D1", " "); dt.addRow("A2", "B2", " ", " ", "E2"); dt.addRow("A3"); DataTable merged = DataTableUtils.mergeComplementaryColumns(dt); assertThat(merged.getColumnsCount(), is(3)); assertThat(merged.getColumn(0), is(Arrays.asList("H1", "A1", "A2", "A3"))); assertThat(merged.getColumn(1), is(Arrays.asList("H2", "B1", "B2", ""))); assertThat(merged.getColumn(2), is(Arrays.asList("H4", "D1", "E2", ""))); }
public static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables) { List<DataTable> results = new ArrayList<>(); for(DataTable dt: dataTables) { results.add(mergeComplementaryColumns(dt)); } return results; }
DataTableUtils { public static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables) { List<DataTable> results = new ArrayList<>(); for(DataTable dt: dataTables) { results.add(mergeComplementaryColumns(dt)); } return results; } }
DataTableUtils { public static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables) { List<DataTable> results = new ArrayList<>(); for(DataTable dt: dataTables) { results.add(mergeComplementaryColumns(dt)); } return results; } private  DataTableUtils(); }
DataTableUtils { public static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables) { List<DataTable> results = new ArrayList<>(); for(DataTable dt: dataTables) { results.add(mergeComplementaryColumns(dt)); } return results; } private  DataTableUtils(); static List<DataTable> mergeTablesSpanningMultiplePages(List<DataTable> dataTables); static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables); static void addBlankColumnsToMatchHeaders(DataTable a, DataTable b); static boolean areComplementary(List<String> column1, List<String> column2); }
DataTableUtils { public static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables) { List<DataTable> results = new ArrayList<>(); for(DataTable dt: dataTables) { results.add(mergeComplementaryColumns(dt)); } return results; } private  DataTableUtils(); static List<DataTable> mergeTablesSpanningMultiplePages(List<DataTable> dataTables); static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables); static void addBlankColumnsToMatchHeaders(DataTable a, DataTable b); static boolean areComplementary(List<String> column1, List<String> column2);  }