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

/**
 * @param col/* www  .  java2  s  .  co m*/
 * @return
 */
public static boolean checkEmpty(Collection<?> col) {
    return null == col || col.isEmpty();
}

From source file:Main.java

/**
 * Method to verify if a collection is empty (including null).
 *
 * @param col a {@link java.util.Collection} object.
 * @return a boolean.// www. j  a v a 2 s  .  c o m
 */
public static boolean isEmpty(Collection col) {
    return (col == null || col.isEmpty());
}

From source file:Main.java

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

From source file:Main.java

public static <T> boolean doesNotContainNull(Collection<T> collection) {
    if (collection.isEmpty()) {
        return true;
    }/*from   www  .  j  av  a2 s  .co m*/
    for (T t : collection) {
        if (t == null) {
            return false;
        }
    }
    return true;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static boolean isEmpty(Collection array) {
    return array == null || array.isEmpty();
}

From source file:Main.java

public static String[] toArray(Collection<String> strings) {
    if (strings.isEmpty()) {
        return EMPTY_STRING_ARRAY;
    }/*from  w  w  w.  j  a v  a2 s  .  c o m*/
    return strings.toArray(new String[strings.size()]);
}

From source file:Main.java

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

From source file:Main.java

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