Java tutorial
//package com.java2s; import java.util.Collection; import java.util.List; import java.util.Map; public class Main { public static boolean isEmpty(String string) { return (string == null || string.length() == 0 || string.trim().length() == 0); } public static <V> boolean isEmpty(V[] sourceArray) { return (sourceArray == null || sourceArray.length == 0); } public static <V> boolean isEmpty(Collection<V> c) { return (c == null || c.size() == 0); } public static <V> boolean isEmpty(List<V> sourceList) { return (sourceList == null || sourceList.size() == 0); } public static <K, V> boolean isEmpty(Map<K, V> sourceMap) { return (sourceMap == null || sourceMap.size() == 0); } }