Example usage for java.util Collection isEmpty

List of usage examples for java.util Collection isEmpty

Introduction

In this page you can find the example usage for java.util Collection isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this collection contains no elements.

Usage

From source file:Main.java

public static <T> boolean isEmpty(Collection<T> list) {
    return list == null || list.isEmpty();
}

From source file:Main.java

public static <T> boolean collectionIsNotNullOrEmpty(Collection<T> colllection) {
    return colllection != null && !colllection.isEmpty();
}

From source file:Main.java

public static boolean isEmpty(Collection collection) {
    if (collection == null || collection.isEmpty()) {
        return true;
    }//from  w ww.j a  v  a 2s  .c o m
    return false;
}

From source file:Main.java

public static <T> boolean isEmpty(Collection<T> col) {
    if (col == null || col.isEmpty()) {
        return true;
    }/*from   w ww . ja va 2 s  .  c o  m*/

    return false;
}

From source file:Main.java

public static boolean isEmpty(Collection<?> collect) {
    return collect == null || collect.isEmpty();
}

From source file:Main.java

/**
 * @author DUYPT/*from   w  ww.  j a  v  a 2s. co  m*/
 * @param data
 * @return
 */
public static boolean isNullOrEmpty(Collection<Object> data) {
    if (data != null && !data.isEmpty()) {
        return true;
    }
    return false;
}

From source file:Main.java

/**
 * @return the first element of given coll, if collection is non-null and non-empty. Otherwise null. 
 *///from  w w  w .j  a  v  a 2  s . com
public static <T> T getFirstElementOrNull(Collection<T> coll) {
    if (coll == null || coll.isEmpty())
        return null;
    return coll.iterator().next();
}

From source file:Main.java

public static <E> boolean isEmpty(Collection<E> collection) {
    return (collection != null && !collection.isEmpty());
}

From source file:Main.java

public static <E extends Object> boolean isEmpty(Collection<E> collection) {

    return null == collection || collection.isEmpty();
}

From source file:Main.java

@SuppressWarnings("rawtypes")
public static boolean isEmpty(Collection coll) {
    return (coll == null || coll.isEmpty());
}