Here you can find the source of isEmpty(Collection
isEmpty(null) = true; isEmpty({}) = true; isEmpty({1}) = false;
Parameter | Description |
---|---|
V | a parameter |
c | a parameter |
public static <V> boolean isEmpty(Collection<V> c)
//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); } }