Java Collection Empty isEmpty(Collection collection)

Here you can find the source of isEmpty(Collection collection)

Description

Return true if the supplied Collection is null or empty.

License

Open Source License

Parameter

Parameter Description
collection the Collection to check

Return

whether the given Collection is empty

Declaration

public static boolean isEmpty(Collection collection) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    /**//w w  w  . j av a2  s  .  c o  m
     * Return {@code true} if the supplied Collection is {@code null}
     * or empty. Otherwise, return {@code false}.
     *
     * @param collection the Collection to check
     * @return whether the given Collection is empty
     */
    public static boolean isEmpty(Collection collection) {
        return (collection == null || collection.isEmpty());
    }

    /**
     * Return {@code true} if the supplied Map is {@code null}
     * or empty. Otherwise, return {@code false}.
     *
     * @param map the Map to check
     * @return whether the given Map is empty
     */
    public static boolean isEmpty(Map map) {
        return (map == null || map.isEmpty());
    }
}

Related

  1. isEmpty(Collection c)
  2. isEmpty(Collection c)
  3. isEmpty(Collection c)
  4. isEmpty(Collection c)
  5. isEmpty(Collection col)
  6. isEmpty(Collection collection)
  7. isEmpty(Collection collection)
  8. isEmpty(Collection collection)
  9. isEmpty(Collection collection)