Java Collection Empty isEmpty(Collection c)

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

Description

is null or its size is 0
 isEmpty(null)   =   true; isEmpty({})     =   true; isEmpty({1})    =   false; 

License

Apache License

Parameter

Parameter Description
V a parameter
c a parameter

Return

if collection is null or its size is 0, return true, else return false.

Declaration

public static <V> boolean isEmpty(Collection<V> c) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    /**/* ww  w.j a va 2 s . c o m*/
     * is null or its size is 0
     * 
     * <pre>
     * isEmpty(null)   =   true;
     * isEmpty({})     =   true;
     * isEmpty({1})    =   false;
     * </pre>
     * 
     * @param <V>
     * @param c
     * @return if collection is null or its size is 0, return true, else return false.
     */
    public static <V> boolean isEmpty(Collection<V> c) {
        return (c == null || c.size() == 0);
    }
}

Related

  1. isEmpty(Collection collection)
  2. isEmpty(Collection collection)
  3. isEmpty(Collection collection)
  4. isEmpty(Collection collection, String messgae)
  5. isEmpty(Collection items)
  6. isEmpty(final Collection values)
  7. isEmpty(final Collection coll)
  8. isEmpty(final Collection collection)
  9. isEmpty(final Collection collection)