Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Map; public class Main { /** * return collection is empty * @param c * @return */ public static <E> boolean isEmpty(Collection<E> c) { return (null == c || c.isEmpty()); } /** * return map is empty * @param map * @return */ public static <K, V> boolean isEmpty(Map<K, V> map) { return (null == map || map.isEmpty()); } /** * return array is empty * @param arr * @return */ public static <T> boolean isEmpty(T[] arr) { return null == arr || arr.length == 0; } }