Java tutorial
//package com.java2s; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; public class Main { public static <T> boolean isNullOrEmpty(List<T> list) { return isNullOrEmpty((Collection<T>) list); } public static <T> boolean isNullOrEmpty(Set<T> set) { return isNullOrEmpty((Collection<T>) set); } /** * Returns <code>true</code> if <code>collection</code> is <code>null</code> * or its size <code>== 0</code>. */ public static <T> boolean isNullOrEmpty(Collection<T> collection) { if ((collection == null) || collection.isEmpty()) { return true; } return false; } public static <K, V> boolean isNullOrEmpty(Map<K, V> map) { if ((map == null) || map.isEmpty()) { return true; } return false; } }