Here you can find the source of print(List
private static List<Integer> print(List<Integer> list)
//package com.java2s; //License from project: Apache License import java.util.List; import java.util.Map; import java.util.Set; public class Main { private static List<Integer> print(List<Integer> list) { System.out.println(list.getClass().toString()); for (Integer integer : list) { System.out.println(integer); }// w ww .jav a 2s . co m System.out.println("==================="); return list; } private static Set<Integer> print(Set<Integer> set) { System.out.println(set.getClass().toString()); for (Integer integer : set) { System.out.println(integer); } System.out.println("==================="); return set; } private static Map<Integer, Integer> print(Map<Integer, Integer> map) { System.out.println(map.getClass().toString()); Set<Map.Entry<Integer, Integer>> entrySet = map.entrySet(); for (Map.Entry<Integer, Integer> entry : entrySet) { System.out.println(entry.getKey() + " : " + entry.getValue()); } System.out.println("==================="); return map; } }