public class TableFormatter<T>
extends java.lang.Object
Constructor and Description |
---|
TableFormatter() |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(java.lang.String title,
java.util.function.Function<T,java.lang.String> valueGetter,
int prefixLimit,
int suffixLimit)
Adds a column to be printed in this table.
|
void |
print(java.util.Collection<T> values,
java.io.PrintStream out)
Print out a table with the given values to the given stream.
|
public void addColumn(@NonNull java.lang.String title, @NonNull java.util.function.Function<T,java.lang.String> valueGetter, int prefixLimit, int suffixLimit)
title
- The title to be shown at the top of the column.valueGetter
- Function
returning the value to be shown in the column.prefixLimit
- Max characters to show before "..." if the value is long.suffixLimit
- Max characters to show after "..." if the value is long.public void print(@NonNull java.util.Collection<T> values, @NonNull java.io.PrintStream out)
addColumn(String, Function, int, int)