Java tutorial
//package com.java2s; import java.util.List; import java.util.Map; public class Main { /** * Beware, the valid word "null" is also rendered as empty. * * @param str * @return */ public static boolean isEmpty(String str) { return str == null || "".contentEquals(str) || "null".contentEquals(str); } public static <K, V> boolean isEmpty(Map<K, V> map) { return map == null || map.isEmpty(); } public static <T> boolean isEmpty(List<T> l) { return l == null || l.isEmpty(); } }