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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

/**
 * Returns true if the collection is null or 0-length.
 *
 * @param collection the collection to be examined
 * @return true if str collection null or zero length
 *//*  w  ww.  j av a2  s .c om*/
public static boolean isEmpty(Collection<?> collection) {
    if (collection == null || collection.isEmpty() || collection.size() == 0) {
        return true;
    } else {
        return false;
    }
}

From source file:Main.java

/**
 * Implementation of the OCL//from   w ww  .j a v a2  s  .c  om
 * <tt>Collection::isEmpty() : Boolean</tt>
 * operation.
 * 
 * @param self the source collection
 * @return whether the collection does not have any elements
 */
public static boolean isEmpty(Collection<?> self) {
    return self.isEmpty();
}

From source file:Main.java

public static <T> T getFirstElement(Collection<T> collection) {
    if (collection == null || collection.isEmpty()) {
        return null;
    }//from   w  w w .jav a  2  s.  c om

    return collection.iterator().next();
}

From source file:Main.java

/**
 * INTERNAL: Gets the first object in the collection. If the
 * collection is empty, null is returned.
 *//*from  w w w.  ja va  2  s. c  o m*/
public static <T> T getFirst(Collection<T> coll) {
    return (coll == null) || coll.isEmpty() ? null : coll.iterator().next();
}

From source file:Main.java

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

From source file:Main.java

/**
 * Checks if a collection is null or empty
 *
 * @param collection - the collection// w ww .j ava  2 s .  c o m
 * @return - if it is empty
 * @since 1.0
 */
public static boolean isEmpty(Collection collection) {
    return collection == null || collection.isEmpty();
}