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<?> c) {
    //      return (null != c && c.isEmpty()); // 20160616 mod 
    return (null == c || c.isEmpty());
}

From source file:Main.java

public static boolean isEmpty(Collection collection) {
    if (null == collection) {
        return true;
    } else {/*from w ww.  j a v a2s  .c  o m*/
        return collection.isEmpty();
    }
}

From source file:Main.java

/**
 * Check if collection is not <tt>null</tt> and empty
 * //ww  w . ja  v  a  2  s  .  c  o m
 * @param collection
 *          Collection to check
 * 
 * @return <tt>true</tt>, if collection is not null and empty, else <tt>false</tt>
 */
public static <T> boolean isEmpty(final Collection<T> collection) {
    return collection != null && collection.isEmpty();
}

From source file:Main.java

/**
 *
 * @param collection//from w  w  w  .j  ava 2  s.  c o  m
 * @return
 */
public static boolean isEmpty(Collection collection) {
    if (null == collection) {
        return true;
    } else if (collection.isEmpty()) {
        return true;
    }
    return false;
}

From source file:Main.java

public static boolean isEmpty(java.util.Collection<?> collection) {
    if (collection == null) {
        return true;
    }//  w  w  w  .  ja  v a 2 s.  co m
    return collection.isEmpty();
}

From source file:Main.java

/**
 * Get a child element with the specified localName. Assumption is that it
 * is in the same namespace as the specified element.
 * /*w  ww.j  a v a  2 s . c o m*/
 * @param element
 * @param localName
 * @return
 */
public static Element getElement(Element element, String localName) {
    Collection<Element> elements = getElementsByTagName(element, localName);
    if (elements.isEmpty()) {
        return null;
    } else {
        return elements.iterator().next();
    }
}

From source file:Main.java

/**
 * Null-safe check if the specified collection is empty.
 * <p>/*from  w w w. j a  v  a2  s. c  o m*/
 * Null returns true.
 *
 * @param coll  the collection to check, may be null
 * @return true if empty or null
 * @since 3.2
 */
public static boolean isEmpty(final Collection<?> coll) {
    return coll == null || coll.isEmpty();
}

From source file:Main.java

public static boolean isEmpty(Collection<?> collection) {
    if (null == collection) {
        return true;
    } else {/*w  w  w .  j  a  v a2s .c  o m*/
        return collection.isEmpty();
    }
}

From source file:com.dsh105.echopet.compat.api.plugin.ModuleLogger.java

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

From source file:Main.java

/**
 * Tells if a given collection is null or empty.
 *
 * @param collection The collection to be evaluated.
 * @return {@code true} if the given collection is null or empty.
 *///from www. j  a  v  a2  s.  c o m
public static boolean isEmptyOrNull(final Collection<?> collection) {
    return collection == null || collection.isEmpty();
}