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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

/**
 * @param coll//from www.  java 2 s. co m
 * @return (coll == null) || coll.isEmpty();
 */
public static boolean isNullOrEmpty(Collection<?> coll) {
    return (coll == null) || coll.isEmpty();
}

From source file:Main.java

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

From source file:Main.java

/**
 * Indicates whether a collection is {@code null} or empty.
 * @param c the collection to be tested//  w  w w . jav  a  2 s  .c om
 * @return {@code true} if the collection is {@code null} or empty
 */
public static <T> boolean nullOrEmpty(Collection<T> c) {
    return null == c || c.isEmpty();
}

From source file:Main.java

public static String join(Collection<?> coll, String delimiter) {
    if (coll.isEmpty()) {
        return "";
    }// ww w.j  a v a 2 s  . c om
    Iterator<?> it = coll.iterator();
    String s = String.valueOf(it.next());
    while (it.hasNext()) {
        s += delimiter;
        s += String.valueOf(it.next());
    }
    return s;
}