import java.util.*;
import java.util.function.*;

public class PrintCollection {
	public static void main(String [] args) {
		ArrayList<Integer> a = new ArrayList<Integer>(Arrays.asList(new Integer [] {1, 2, 3, 4, 5, 6}));
		printCollection(a, new Consumer<Integer>() {
							public void accept(Integer e) {System.out.println(e);}
					});	
	}

	static <T> void printCollection(Collection<T> c, Consumer<T> action) {
		for (T e : c)
			action.accept(e);
	}
}
