Here you can find the source of print(List
public static <E> void print(List<E> list)
//package com.java2s; //License from project: Open Source License import java.util.List; import java.util.Map; public class Main { public static void print(String str) { System.out.println(str);/*from www . j ava2 s. c o m*/ } public static <E> void print(List<E> list) { for (E li : list) System.out.println(li); } public static <K, V> void print(Map<K, V> map) { for (Map.Entry<K, V> m : map.entrySet()) { System.out.println(m.getKey() + " , " + m.getValue()); } } public static <K, V> void print(Map<K, V> map, int n) { int k = 0; for (Map.Entry<K, V> m : map.entrySet()) { System.out.println(m.getKey() + " , " + m.getValue()); k++; if (k > n) break; } } public static void print(double d) { System.out.println(d); } }