-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a utility method to get table rows as Collection #10
Comments
These two utility methods are required
|
@sibiarunachalam Not sure how much utility these methods provide when you can achieve the same effect in 1 line by creating the table normally and then splitting the result by new line? E.g.:
Or just Java 11:
|
Yes, @freva this workaround will solve the problem.
Let say if we had those utility method, which approach would you prefer in my scenario? |
Since ASCII tables is inherently for humans and not machines, I don't think/hope anyone would use this for anything more than a thousand rows, which makes any performance issue coming from the reverse processing negligible. The library supports linebreaks in the data, feel free to try the split on this example: https://github.com/freva/ascii-table/blob/d19f522aaccd4a0e057f9843b7d722957c595559/src/test/java/com/github/freva/asciitable/AsciiTableTest.java#L320:L363 To make a utility method worthwhile, it should either solve a non-trivial problem or solve a frequent problem to the users. In my opinion, the solution/workaround is trivial, so it's not that. And I'm not convinced this is a frequent problem, how often would someone need to post-process something a table, specifically on row level? Maybe if this output all the cells, without borders, I could see it, because then the developers could actually customize a lot. With pure rows (including borders), all you can do is join it back together, or filter/insert some rows. |
Okay @freva, thanks for your feedback. |
It would be flexible if you provide a utility method that simply returns collection of rows in the table.
To say exactly the result of below method.
private static List<String> getTableRows(int[] colWidths, HorizontalAlign[] headerAligns, HorizontalAlign[] dataAligns, HorizontalAlign[] footerAligns, Character[] borderChars, String[] header, String[][] data, String[] footer) {
The text was updated successfully, but these errors were encountered: