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

public static <T> boolean isNotEmpty(Collection<T> collection) 

Method Source Code

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

import java.util.Collection;

public class Main {
    /**/*  w  w  w  .  jav a 2 s. c om*/
     * @return TRUE if string != null && string.length() > 0
     */
    public static <T> boolean isNotEmpty(String string) {
        return string != null && string.length() > 0;
    }

    /**
     * @see ObjectUtils#isEmpty(Collection)
     */
    public static <T> boolean isNotEmpty(Collection<T> collection) {
        return !isEmpty(collection);
    }

    /**
     * @return TRUE is collection is null or contains no elements
     */
    public static <T> boolean isEmpty(Collection<T> collection) {
        return collection == null || collection.size() == 0;
    }

    /**
     * @return TRUE if string == null || string.length() == 0
     */
    public static <T> boolean isEmpty(String string) {
        return string == null || string.length() == 0;
    }
}

Related

  1. isNotEmpty(Collection collection)
  2. isNotEmpty(Collection collection)
  3. isNotEmpty(Collection source)
  4. isNotEmpty(Collection values)
  5. isNotEmpty(Collection... colls)
  6. isNotEmpty(Collection collection)
  7. isNotEmpty(Collection values)
  8. isNotEmpty(E collection)
  9. isNotEmpty(final Collection coll)