Java Collection Empty isNotEmpty(Collection collection)

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

Description

is Not Empty

License

Open Source License

Declaration

@SuppressWarnings("rawtypes")
    public static Boolean isNotEmpty(Collection collection) 

Method Source Code

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

import java.util.Collection;

public class Main {
    @SuppressWarnings("rawtypes")
    public static Boolean isNotEmpty(Collection collection) {
        return !collection.isEmpty();
    }//  w  w  w .  j a v a2s. c  o  m

    /**
     * Verifica se um objeto é vazio.
     * 
     * @param obj
     * @return <b>true</b> se o objeto for vazio(empty).
     */
    public static boolean isEmpty(Object obj) {
        if (obj == null)
            return true;
        if (obj instanceof Collection)
            return ((Collection<?>) obj).size() == 0;

        final String s = String.valueOf(obj).trim();

        return s.length() == 0 || s.equalsIgnoreCase("null");
    }

    @SuppressWarnings("rawtypes")
    public static Boolean isEmpty(Collection collection) {
        return collection.isEmpty();
    }
}

Related

  1. isNonEmpty(Collection coll)
  2. isNonEmpty(final Collection values)
  3. isNotEmpty(@SuppressWarnings("rawtypes") Collection collection)
  4. isNotEmpty(Collection c)
  5. isNotEmpty(Collection collection)
  6. isNotEmpty(Collection collection)
  7. isNotEmpty(Collection collection)
  8. isNotEmpty(Collection collection)
  9. isNotEmpty(Collection collection)