Here you can find the source of prettyPrintList(List
Parameter | Description |
---|---|
list | the list of items to be pretty printed. |
public static String prettyPrintList(List<Integer> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { private static final String ITEM_DELIMITER = "-"; /**/*from ww w.j a v a2 s. co m*/ * Takes a list of integers and returns a conveniently formatted string. We * need this to create filenames with the elements of the lists in them. * * @param list the list of items to be pretty printed. * @return String representation of the elements of said list */ public static String prettyPrintList(List<Integer> list) { String result = ""; for (int i = 0; i < list.size(); i++) { result += list.get(i).toString(); if (i < list.size() - 1) { result += ITEM_DELIMITER; } } return result; } }