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

voidprintListPair(List list)
print List Pair
if (list.isEmpty())
    System.out.println("\tNO ITEM !!");
for (int i = 0; i < list.size(); i++) {
    System.out.print(list.get(i) + " ");
    if ((i + 1) % 2 == 0)
        System.out.println();
StringprintListStrings(List list, String listDescription)
print List Strings
StringBuilder sb = new StringBuilder();
sb.append("\nLIST_START of " + listDescription + " count:" + list.size()).append("\n[\n");
for (String s : list) {
    sb.append(s).append("\n");
sb.append("]\nLIST_END of " + listDescription + " count:" + list.size()).append("\n");
return sb.toString();
voidprintListV(List l)
print List V
for (int i = 0; i < l.size(); i++)
    System.out.println(l.get(i));
StringprintListWithDelimiter(Collection list, String delimiter)
print List With Delimiter
boolean first = true;
StringBuilder sb = new StringBuilder();
for (T el : list) {
    if (first) {
        first = false;
    } else {
        sb.append(delimiter);
    sb.append(el);
return sb.toString();
voidprintln(List text)
println
System.out.println(
        "---------------------------------------------------------------------------------------\n");
for (String line : text) {
    System.out.println(line);
voidprintlnList(List list)
println List
if (list != null) {
    for (Object o : list) {
        System.out.println(o.toString());
} else {
    System.out.println("list is null");
voidprintMap(HashMap> listHashMap)
print Map
for (String s : listHashMap.keySet()) {
    System.out.print(s + ": [");
    for (String n : listHashMap.get(s)) {
        System.out.print(n + " ");
    System.out.print("]\n");
voidprintNonEmptyList(List list)
print Non Empty List
int len = list.size();
System.out.print("[");
for (int i = 0; i < len; i++) {
    if (i == len - 1) {
        System.out.println(list.get(i) + "]");
    } else {
        System.out.print(list.get(i) + ", ");
voidprintObjectList(List list)
Print a list of Strings separated by '/'
System.out.println("*StringList print starts:");
for (Object s : list) {
    System.out.print("/" + s.toString());
System.out.print("*StringList print ends.");
System.out.println();
voidprintout(List record)
printout
boolean firstLoop = true;
for (String s : record) {
    if (firstLoop) {
        firstLoop = false;
    } else {
        System.out.print("|");
    System.out.print(s);
...