Android Collection Empty Check isEmpty(Collection collection)

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

Description

Return true if the supplied Collection is null or empty.

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;

import java.util.Collection;

import java.util.Map;

public class Main {
    /**//from www.ja v  a 2s. c om
     * 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. isAnyStringEmpty( Collection collection)
  2. isEmpty(Collection coll)
  3. isEmpty(Collection coll)
  4. isEmpty(Collection collection)
  5. isEmpty(Collection collection)