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

voidprintIndex(final Map> index)
print Index
index.entrySet().forEach(
        e -> System.out.println("Class '" + e.getKey() + "' has following subclasses: " + e.getValue()));
voidprintIntegerArrayList(ArrayList arr)
print Integer Array List
for (int i = 1; i <= arr.size(); i++) {
    System.out.print(Arrays.toString(arr.get(i - 1)) + "  ");
    if (i % 10 == 0) {
        System.out.println();
voidprintIntegerList(List array)
print Integer List
System.out.print("[");
int i = 0;
for (Integer integer : array) {
    System.out.print(integer);
    if (i != array.size() - 1) {
        System.out.print(", ");
    } else {
        System.out.println("]");
...
voidprintItemList(String label, List itemList)
print Item List
System.out.print("\t" + label);
int itemCount = 0;
if (itemList == null) {
    System.out.print("\t[null]");
} else {
    for (String item : itemList) {
        if (itemCount == 0) {
            System.out.print("\t[");
...
voidprintLines(List lines)
Print the output lines
for (String s : lines) {
    System.out.println(s);
StringprintLinkedList(String prefix, LinkedList list)
print Linked List
StringBuilder sb = new StringBuilder();
Iterator<?> it = list.iterator();
sb.append(prefix).append(" [");
while (it.hasNext()) {
    sb.append(it.next().toString());
sb.append("]");
return sb.toString();
...
StringBufferprintList(Collection list)
Escapes the items of the Collection and returns them in a StringBuffer, separated by commas.
StringBuffer sb = new StringBuffer();
if (list != null && list.size() > 0) {
    Iterator<String> iter = list.iterator();
    while (true) {
        sb.append(escape(iter.next()));
        if (iter.hasNext()) {
            sb.append(", ");
        } else {
...
voidprintList(final List list)
print List
for (Iterator it = list.iterator(); it.hasNext();) {
    final Object o = it.next();
    System.out.println("{List} " + o);
StringprintList(List l)
print List
Iterator i = l.iterator();
if (!i.hasNext())
    return "[]";
StringBuilder sb = new StringBuilder();
sb.append("[\n");
for (;;) {
    Object e = i.next();
    sb.append(e == l ? "(this Collection)" : e);
...
voidprintList(List l)
print List
String print = "Size is " + l.size() + ": ";
for (int i = 0; i < l.size(); i++) {
    print += l.get(i).toString() + ", ";
System.out.println(print);