class DataTableUtils {

    public static List<DataTable> mergeTablesSpanningMultiplePages(List<DataTable> dataTables) {
        List<DataTable> results = new ArrayList<>();
        DataTable current = null;

        for (DataTable dt : dataTables) {
            if (current != null) {
                if (current.hasSameHeaderBlanksIgnoredAs(dt)) {
                    addBlankColumnsToMatchHeaders(current, dt);
                }
                
                if (current.hasSameColumnCountAs(dt)) {
                    current = current.mergeWith(dt);
                } else {
                    results.add(current);
                    current = dt;
                }
            } else {
                current = dt;
            }
        }

        if (current != null) {
            results.add(current);
        }

        return results;
    }

    private  DataTableUtils();

}