Java Collection Empty isEmpty(Collection v)

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

Description

See Javadoc above

License

Open Source License

Declaration

public static boolean isEmpty(Collection v) 

Method Source Code


//package com.java2s;
import java.util.Collection;
import java.util.Map;

public class Main {
    /**/*from   ww  w. jav a2s .com*/
    * Series of utilities to ensure that parameters not null, empty, 
    * less than 1 or == 0 
    *  
    * @param String, Object, Collection, Map 
    * @return boolean      
    * @throws n/a
    */

    public static boolean isEmpty(String s) {

        boolean retVal = true;

        if (s == null || s.trim().equals("") || s.length() < 1) {
            retVal = true;
        } else {
            retVal = false;
        }

        return retVal;

    }

    /**
     * See Javadoc above
     */

    public static boolean isEmpty(Object obj) {
        boolean retVal = true;

        if (obj == null) {
            retVal = true;
        } else {
            retVal = false;
        }

        return retVal;

    }

    /**
     * See Javadoc above
     */
    public static boolean isEmpty(Collection v) {
        boolean retVal = true;

        if (v == null || v.isEmpty() || v.size() == 0) {
            retVal = true;
        } else {
            retVal = false;
        }

        return retVal;

    }

    /**
     * See Javadoc above
     */

    public static boolean isEmpty(Map m) {
        boolean retVal = true;

        if (m == null || m.isEmpty() || m.size() == 0) {
            retVal = true;
        } else {
            retVal = false;
        }

        return retVal;

    }
}

Related

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