Java Utililty Methods Collection Empty

List of utility methods to do Collection Empty

Description

The list of methods to do Collection Empty are organized into topic(s).

Method

booleanisNotEmpty(E collection)
is Not Empty
if (collection == null)
    return false;
if (collection.isEmpty())
    return false;
return true;
booleanisNotEmpty(final Collection coll)
Return if a collection is not empty.
return !isEmpty(coll);
booleanisNotEmpty(final Collection collection)
Convenience method to determine that a collection is not empty or null.
return collection != null && !collection.isEmpty();
booleanisNotEmpty(final Collection collection)
Returns true if this collection contains elements.
return collection != null && !collection.isEmpty();
booleanisNotEmpty(final Collection collection)
Returns true if the collection is both not null and not empty; false otherwise.
return !isEmpty(collection);
booleanisNotEmpty(final Collection c)
Check if a collection of a string is not empty.
return !isEmpty(c);
TisNotEmpty(T collection, String exceptionMessage)
Validates that a collection is not empty.
if (collection.size() == 0) {
    throw new IllegalArgumentException(exceptionMessage);
return collection;
booleanisNotEmptyCollection(Collection collection)
is Not Empty Collection
return !isEmptyCollection(collection);
booleanisNotEmptyCollection(Object[] objs)
is Not Empty Collection
return objs != null && objs.length > 0;
voidisNotEmptyException(Collection collection)
is Not Empty Exception
if (!collection.isEmpty()) {
    throw new IllegalArgumentException("The given collection cannot be non-empty.");