Here you can find the source of print(Collection c)
@SuppressWarnings("unchecked") public static final void print(Collection c)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { @SuppressWarnings("unchecked") public static final void print(Collection c) { if (isEmpty(c)) { return; }/*w w w .j a v a 2 s . c om*/ for (Object object : c) { } } @SuppressWarnings("unchecked") public static final boolean isEmpty(Collection c) { return null == c || 0 == c.size() ? true : false; } public static boolean isEmpty(Collection<?>... colls) { boolean result = false; for (Collection<?> coll : colls) { if (null == coll || coll.isEmpty()) { result = true; break; } } return result; } public static boolean isEmpty(Map<?, ?>... maps) { boolean result = false; for (Map<?, ?> map : maps) { if (null == map || map.isEmpty()) { result = true; break; } } return result; } }