print Collection - Java java.util

Java examples for java.util:Collection Operation

Description

print Collection

Demo Code


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

public class Main {
    public static <T> void printCollection(Iterable<T> coll) {

        for (T i : coll) {
            System.out.print(i + ",");
        }//w w w . ja  va  2 s .c o m

        System.out.println("");
    }

    public static <T> void printCollection(Collection<T> collection,
            String separtor) {

        for (T item : collection) {
            System.out.print(item + separtor);
        }
        System.out.println();
    }
}

Related Tutorials