Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Map; public class Main { @SuppressWarnings({ "rawtypes" }) public static void print(Collection coll) { if (isNotNull(coll)) { System.out.println("********************************************"); for (Object t : coll) { if (t instanceof Collection) { print((Collection) t); } else { System.out.println(t); } } return; } } @SuppressWarnings("rawtypes") public static void print(Map map) { if (isNotNull(map)) { System.out.println("********************************************"); for (Object key : map.keySet()) { Object value = map.get(key); if (value instanceof Collection) { print((Map) value); } else { System.out.println("Key=" + key + "; Value=" + value); } } return; } } public static void print(Object[] array) { if (isNotNull(array)) { System.out.println("********************************************"); for (Object item : array) { System.out.print(item + "\t"); } } System.out.println(); } public static boolean isNotNull(Object[] array) { return !isNull(array); } public static boolean isNotNull(Collection<?> con) { return !isNull(con); } public static boolean isNotNull(Map<?, ?> map) { return !isNull(map); } public static boolean isNull(Collection<?> con) { if (con == null || con.isEmpty()) { return true; } return false; } public static boolean isNull(Object[] array) { if (array == null || array.length == 0) { return true; } return false; } public static boolean isNull(Map<?, ?> map) { if (map == null || map.isEmpty()) { return true; } return false; } }