Java ArrayList Print printArrayList(ArrayList list)

Here you can find the source of printArrayList(ArrayList list)

Description

print Array List

License

Open Source License

Parameter

Parameter Description
list a parameter

Declaration

public static void printArrayList(ArrayList<String> list) 

Method Source Code


//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from w w w. java  2s .  c  o m*/
     * @param list
     */
    public static void printArrayList(ArrayList<String> list) {
        if (list == null || list.isEmpty()) {
            System.out.println("\tNO ITEM !!");
            return;
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println("  " + (i + 1) + ": " + list.get(i) + "");
        }
    }

    /** @METHOD */
    public static void printArrayList(List<?> list) {
        if (list.isEmpty())
            System.out.println("\tNO ITEM !!");

        for (int i = 0; i < list.size(); i++) {
            System.out.println("  " + (i + 1) + ": " + list.get(i) + "");
        }
    }

    /**
     * @param rtag
     * @param list
     * @param ltag
     */
    public static void printArrayList(String rtag, ArrayList<String> list, String ltag) {
        for (int i = 0; i < list.size(); i++) {
            System.out.println(rtag + list.get(i) + ltag);
        }
    }

    /**
     * @param rtag
     * @param list
     * @param ltag
     * @param isTrim
     */
    public static void printArrayList(String rtag, ArrayList<String> list, String ltag, boolean isTrim) {
        for (int i = 0; i < list.size(); i++) {
            if (isTrim)
                System.out.println(rtag + list.get(i).trim() + ltag);
            else
                System.out.println(rtag + list.get(i) + ltag);
        }
    }
}

Related

  1. print(ArrayList tokens, String symbol)
  2. printArray(ArrayList array)
  3. printArrayArray(ArrayList> matrix)
  4. printArrayList(ArrayList arr)
  5. printArrayList(ArrayList set)
  6. printArrayList(ArrayList _array)
  7. printArrayListInt(ArrayList list)
  8. printComboBoxView(ArrayList alOptionValue, String sDefaultValue)
  9. printEdgeCycleMembership(final int[][] cyclesData, final ArrayList[] nodeCycleMembership)