Here you can find the source of printArrayList(ArrayList
Parameter | Description |
---|---|
list | a parameter |
public static void printArrayList(ArrayList<String> list)
//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); } } }