@Test public void mergeComplementaryColumns() { DataTable dt = new DataTable(1); dt.addRow("Vehicle type", "", "Brand"); dt.addRow("Car", "Audi", ""); dt.addRow("Car", "Mercedes", ""); dt.addRow("Truck", "Volvo", ""); dt.addRow("Truck", "DAF", ""); DataTable merged = DataTableUtils.mergeComplementaryColumns(dt); assertThat(merged.getColumnsCount(), is(2)); assertThat(merged.getRowsCount(), is(5)); assertThat(merged.getColumn(0), is(Arrays.asList("Vehicle type", "Car", "Car", "Truck", "Truck"))); assertThat(merged.getColumn(1), is(Arrays.asList("Brand", "Audi", "Mercedes", "Volvo", "DAF"))); assertThat(dt.getColumnsCount(), is(3)); }
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);  }