Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Map; public class Main { /** * Null-safe check if the specified collection is empty. * * @param coll the collection to check, may be null * @return true if empty or null */ public static boolean isEmpty(Collection<?> coll) { return (coll == null || coll.isEmpty()); } /** * Null-safe check if the specified collection is empty. * * @param coll the collection to check, may be null * @return true if empty or null */ public static boolean isEmpty(Map<?, ?> coll) { return (coll == null || coll.isEmpty()); } }