public static <T> String fromCollection(final Collection<T> data, boolean sortColumns) {
        if (data == null || data.isEmpty()) {
            return "NO DATA";
        }

        final T item = data.iterator().next();
        final TableBuilder<T> tableBuilder = builder(data);

        if (item instanceof String
                || Number.class.isAssignableFrom(item.getClass())
                || Temporal.class.isAssignableFrom(item.getClass())) {
            // Simple single column table so don't try and get getters.
            tableBuilder.withColumn(Column.of(item.getClass().getSimpleName(), Object::toString));
        } else {
            Stream<Method> methodNameStream = Arrays.stream(item.getClass().getDeclaredMethods());

            if (item.getClass().isRecord()) {
                methodNameStream = methodNameStream.filter(method -> {
                    final String methodName = method.getName();
                    return !IGNORED_RECORD_METHOD_NAMES.contains(methodName);
                });
            } else {
                methodNameStream = methodNameStream.filter(method -> {
                    final String methodName = method.getName();
                    return methodName.startsWith("get") || methodName.startsWith("is");
                });
            }

            if (sortColumns) {
                methodNameStream = methodNameStream.sorted(Comparator.comparing(Method::getName));
            }
            methodNameStream.forEach(method -> {
                final Column<T, ?> column = convertToColumn(method);
                tableBuilder.withColumn(column);
            });
        }

        return tableBuilder.build();
    }
Attempts to determine the structure of the table from the public getters
of the collection items. The column names are derived from the method name,
e.g. getFirstNameLength() becomes "First Name Length".
Sub-classes of {@link Number} are right aligned.

@param sortColumns If true columns will be in order of column name, else they will
                   be in no particular order.
@return A {@link String} containing the markdown style table.
stroom-util/src/main/java/stroom/util/logging/AsciiTable.java