Java List Print print(Iterable list)

Here you can find the source of print(Iterable list)

Description

print

License

LGPL

Declaration

public static void print(Iterable list) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    private static boolean verbose = true;

    public static void print(Iterable list) {
        for (Object obj : list)
            System.out.println(obj);
    }/*from ww w  . j a v  a 2s .c o m*/

    /**
     * Print the list elements in raws.
     * The number of elements in a raw is determined by the parameter
     */
    public static void print(ArrayList list, int rawLength, String format) {
        if (rawLength < 1)
            throw new RuntimeException("Raw Length cannot be shorter than one.");
        int i = 0;
        for (Object obj : list) {
            System.out.printf(format, obj);
            if (i % rawLength == 0)
                System.out.println();
            i++;
        }
        System.out.println();
    }

    public static void print(String s) {
        if (verbose)
            System.out.print(s);
    }

    public static void println(String s) {
        if (verbose)
            System.out.println(s);
    }

    public static void println() {
        if (verbose)
            System.out.println();
    }
}

Related

  1. prettyPrintList(List list)
  2. prettyPrintWarningMessage(final List results, final String message)
  3. prettyRoleOutput(List roles, final String delimiter)
  4. print(Collection> collections)
  5. print(int totalErrors, int totalTechnical, int totalSuccess, List filesWithErrorsList)
  6. print(List A, String mode)
  7. print(List items)
  8. print(List list)
  9. print(List list)