Here you can find the source of printListFlat(ArrayList
Parameter | Description |
---|---|
list | a parameter |
public static void printListFlat(ArrayList<String> list)
//package com.java2s; import java.util.ArrayList; public class Main { /**// w w w . j a v a 2s .com * @param list */ public static void printListFlat(ArrayList<String> list) { if (list == null || list.isEmpty()) { System.out.println("\tNO ITEM !!"); return; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { if (i == 0) sb.append("{"); sb.append(list.get(i)); if (i != list.size() - 1) sb.append(","); if (i == list.size() - 1) sb.append("}"); } System.out.println(sb.toString()); } }