TableDiffer { public DataTableDiff calculateUnorderedDiffs() { List<SimpleEntry<List<String>, DiffType>> diffTableRows = new ArrayList<>(); ArrayList<List<String>> extraRows = new ArrayList<>(to.cells()); for (List<String> row : from.cells()) { if (!extraRows.remove(row)) { diffTableRows.add( new SimpleEntry<>(row, DiffType.DELETE)); } else { diffTableRows.add( new SimpleEntry<>(row, DiffType.NONE)); } } for (List<String> cells : extraRows) { diffTableRows.add( new SimpleEntry<>(cells, DiffType.INSERT)); } return DataTableDiff.create(diffTableRows); } TableDiffer(DataTable fromTable, DataTable toTable); DataTableDiff calculateDiffs(); DataTableDiff calculateUnorderedDiffs();  }
@Test void unordered_diff_with_itself() { assertTrue(new TableDiffer(table(), table()).calculateUnorderedDiffs().isEmpty()); }
@Test void unordered_diff_with_itself_in_different_order() { assertTrue(new TableDiffer(table(), otherTableWithDifferentOrder()).calculateUnorderedDiffs().isEmpty()); }