Java Utililty Methods List Print

List of utility methods to do List Print

Description

The list of methods to do List Print are organized into topic(s).

Method

StringgetGenBlueprintName(String slavenodelist, List masterList)
get Gen Blueprint Name
String blueprint;
if (slavenodelist.isEmpty() && masterList.size() == 1) {
    blueprint = "blueprint1m";
} else if (masterList.size() == 1) {
    blueprint = "blueprint1mXd";
} else if (masterList.size() == 2) {
    blueprint = "blueprint2mXd";
} else {
...
StringlimitLengthOfPrintedList(Collection list)
Converts a list to a string that shows at most 100 elements.
return limitLengthOfPrintedList(list, 100);
StringprettyList(final List list)
pretty List
if (list.isEmpty()) {
    return ""; 
final StringBuilder sb = new StringBuilder(list.size() * 10);
for (final String s : list) {
    sb.append(s);
    sb.append(", "); 
return sb.substring(0, sb.length() - 2);
StringprettyList(List list)
pretty List
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++) {
    sb.append(list.get(i).toString());
    if (i < list.size() - 2) {
        sb.append(", ");
    } else if (i == list.size() - 2) {
        if (list.size() > 2) {
            sb.append(",");
...
StringprettyPrint(List userPermissions)
pretty Print
if (userPermissions == null) {
    return "";
StringBuilder sb = new StringBuilder("");
if (userPermissions.contains("read")) {
    sb.append("R");
if (userPermissions.contains("write")) {
...
voidprettyPrint(List rows)
Pretty prints a list of String arrays.
if (!rows.isEmpty()) {
    final int numCol = rows.get(0).length;
    final int[] maxLength = new int[numCol];
    Arrays.fill(maxLength, 0);
    for (String[] row : rows) {
        for (int i = row.length - 1; i >= 0; i--) {
            if (row[i] == null && maxLength[i] < 4)
                maxLength[i] = 4;
...
StringprettyPrintArgv(List argv)
Given an argv array such as might be passed to execve(2), returns a string that can be copied and pasted into a Bourne shell for a similar effect.
StringBuilder buf = new StringBuilder();
for (String arg : argv) {
    if (buf.length() > 0) {
        buf.append(' ');
    buf.append(shellEscape(arg));
return buf.toString();
...
StringprettyPrintList(Collection objects, String separator)
pretty Print List
if (null == objects || objects.isEmpty()) {
    return "";
StringBuffer result = new StringBuffer(400);
int curr = 0;
for (Object mensagem : objects) {
    result.append(mensagem);
    if (++curr < objects.size()) {
...
StringprettyPrintList(List list)
Takes a list of integers and returns a conveniently formatted string.
String result = "";
for (int i = 0; i < list.size(); i++) {
    result += list.get(i).toString();
    if (i < list.size() - 1) {
        result += ITEM_DELIMITER;
return result;
...
voidprettyPrintWarningMessage(final List results, final String message)
pretty print the warning message supplied
for (final String line : message.split("\\r?\\n")) {
    final StringBuilder builder = new StringBuilder(line);
    while (builder.length() > TEXT_WARNING_WIDTH) {
        int space = getLastSpace(builder, TEXT_WARNING_WIDTH);
        if (space <= 0) {
            space = TEXT_WARNING_WIDTH;
        results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder.substring(0, space)));
...