Java tutorial
//package com.java2s; import java.util.*; public class Main { /** * Returns {@code true} if the specified {@code Collection} is {@code null} * or {@link Collection#isEmpty empty}, * {@code false} otherwise. * * @param c the collection to check * @return {@code true} if the specified {@code Collection} is {@code null} * or {@link Collection#isEmpty empty}, * {@code false} otherwise. * @since 1.0 */ public static boolean isEmpty(Collection c) { return c == null || c.isEmpty(); } /** * Returns {@code true} if the specified {@code Map} is {@code null} or {@link Map#isEmpty empty}, * {@code false} otherwise. * * @param m the {@code Map} to check * @return {@code true} if the specified {@code Map} is {@code null} or {@link Map#isEmpty empty}, * {@code false} otherwise. * @since 1.0 */ public static boolean isEmpty(Map m) { return m == null || m.isEmpty(); } }