Table.TableBuilder rows(List<Row> rows) Breaks Internal State Management
Description
The method Table.TableBuilder rows(List<Row> rows) suggests that users can add a list of rows to a Table at once, rather than calling Table.TableBuilder addRow(Row row) repeatedly. However, this approach bypasses the internal state management that is handled within addRow(Row row), potentially leaving the TableBuilder in an inconsistent state.
Suggested Fix
I suggest modifying TableBuilder so that rows(List<Row> rows) internally calls addRow(Row row) for each row:
public TableBuilder rows(final List<Row> rows) {
rows.forEach(this::addRow);
return this;
}
Table.TableBuilder rows(List<Row> rows)Breaks Internal State ManagementDescription
The method
Table.TableBuilder rows(List<Row> rows)suggests that users can add a list of rows to aTableat once, rather than callingTable.TableBuilder addRow(Row row)repeatedly. However, this approach bypasses the internal state management that is handled withinaddRow(Row row), potentially leaving theTableBuilderin an inconsistent state.Suggested Fix
I suggest modifying
TableBuilderso thatrows(List<Row> rows)internally callsaddRow(Row row)for each row: