Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Map; public class Main { public static <T> boolean isEmpty(T[] array) { return (array == null || array.length == 0); } public static boolean isEmpty(Collection<?> collection) { return (collection == null || collection.isEmpty()); } @SuppressWarnings("rawtypes") public static boolean isEmpty(Map map) { return (map == null || map.isEmpty()); } public static boolean isEmpty(String source) { return (source == null || source.trim().equals("")); } public static boolean isEmpty(Object source) { return (source == null || source.toString().trim().equals("")); } }