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 isNullOrEmpty(Collection<T> collection) {
    return collection == null || collection.isEmpty();
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static <E> List<E> copyNullSafeList(Collection<? extends E> list) {
    if (list.isEmpty()) {
        return Collections.emptyList();
    }/*  w  w w.  j  av  a  2s.  co  m*/
    return Collections.unmodifiableList(copyNullSafeMutableList(list));
}

From source file:Main.java

/**
 * Like {@link Collections#max(java.util.Collection)} except with a default value returned in the
 * case of an empty collection.//from  ww w .ja  v a2 s .  co m
 */
public static <T extends Comparable<T>> T maxOr(Collection<T> values, T defaultVal) {
    if (values.isEmpty()) {
        return defaultVal;
    } else {
        return Collections.max(values);
    }
}

From source file:Main.java

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

From source file:Main.java

/**
 * Like {@link Collections#min(java.util.Collection)} except with a default value returned in the
 * case of an empty collection./* w  w  w. ja  v a  2s.  c  o m*/
 */
public static <T extends Comparable<T>> T minOr(Collection<T> values, T defaultVal) {
    if (values.isEmpty()) {
        return defaultVal;
    } else {
        return Collections.min(values);
    }
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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