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 boolean isEmpty(Collection<?> coll) {
    return coll == null || coll.isEmpty();
}

From source file:Main.java

public static Object findOne(Collection coll) {
    if (coll.isEmpty()) {
        return null;
    } else if (coll.size() > 1) {
        throw new RuntimeException("Expected only one member in collection, found many: " + coll.toString());
    } else {/*from w w w.ja v a  2  s  . c om*/
        return coll.iterator().next();
    }
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static int largestList(Collection<? extends Collection> cs) {
    if (cs.isEmpty())
        return -1;
    int large = 0;
    for (Collection c : cs) {
        large = Math.max(large, c.size());
    }//  ww w  . j  a  va 2s .com
    return large;
}

From source file:Main.java

public static <T> boolean isEmpty(Collection<T> list) {

    if (list == null || list.isEmpty() || list.size() == 0) {
        return true;
    }//from ww  w  .  j ava2 s  . co  m
    return false;
}

From source file:Main.java

public static <E> boolean isNil(Collection<E> colletion) {
    return colletion == null || colletion.isEmpty();
}

From source file:Main.java

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

From source file:Main.java

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