Appends the data formatted as a table to the given string builder. The padding character used for the column alignments is a single space (' '), the separate between column headers and values is a dash ('-'). Note that you have to specify a line ending, '\n' isn't used by default. The generated
(StringBuilder destination, String lineEnding)
| 71 | * @param lineEnding the line ending to use for each row of the table |
| 72 | */ |
| 73 | public void append(StringBuilder destination, String lineEnding) |
| 74 | { |
| 75 | List<String> headers = columns.stream().map(c -> c.formatHeader(" ")).collect(Collectors.toList()); |
| 76 | printRow(destination, headers); |
| 77 | destination.append(lineEnding); |
| 78 | printSeparators(destination); |
| 79 | for (Row row : rows) |
| 80 | { |
| 81 | destination.append(lineEnding); |
| 82 | printRow(destination, row.format(columns, " ")); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | private void printSeparators(StringBuilder destination) |
| 87 | { |
no test coverage detected