Java examples for java.util:Collection Operation
Print collection to console
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static void main(String[] argv) { Collection collection = java.util.Arrays.asList("asdf", "java2s.com"); display(collection);/* www . ja v a2 s. co m*/ } public static void display(Collection collection) { Iterator iterator = collection.iterator(); while (iterator.hasNext()) { System.out.print(iterator.next() + " "); } System.out.println(); } }