class MappingDataCSVSupport {

    public List<CSVRow> toCSVRows(MappingData data) {
        List<CSVRow> rows = new ArrayList<>();
        CSVRow headline = new CSVRow();
        rows.add(headline);
        headline.add("Pattern");
        headline.add("Replacement");
        headline.add("Comment");
        for (MappingEntry entry: data.getEntries()) {
            CSVRow row = new CSVRow();
            rows.add(row);
            row.add(entry.getPattern());
            row.add(entry.getReplacement());
            row.add(entry.getComment());
        }
        return rows;
    }

}