Java tutorial
//package com.java2s; import java.util.Map; public class Main { /** * is null or its size is 0 * * <pre> * isEmpty(null) = true; * isEmpty({}) = true; * isEmpty({1, 2}) = false; * </pre> * * @param sourceMap * @return if map is null or its size is 0, return true, else return false. */ public static <K, V> boolean isEmpty(Map<K, V> sourceMap) { return (sourceMap == null || sourceMap.size() == 0); } }