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

booleanisEmptyCollection(Collection col)
is Empty Collection
if (col == null || col.isEmpty()) {
    return true;
return false;
booleanisEmptyCollection(Collection collection)
is Empty Collection
if (collection != null) {
    return collection.size() == 0;
return true;
booleanisEmptyCollection(Object obj)
is Empty Collection
return obj == null || ((Collection) obj).size() == 0;
booleanisEmptyCollection(Object object)
is Empty Collection
if (object instanceof Collection<?>) {
    Collection<?> collection = (Collection<?>) object;
    return isEmpty(collection);
} else {
    return false;
voidisEmptyException(Collection collection)
This method throws an IllegalArgumentException if the given collection is empty.
if (collection.isEmpty()) {
    throw new IllegalArgumentException("The given collection cannot be empty.");
booleanisEmptyNotesField(Collection col)
Tests a collection retrieved by lotus.domino.Document.getItemValue() if it is an empty notes field.
if (col == null || col.size() == 0 || (col.size() == 1 && col.toArray()[0].equals(""))) {
    return true;
} else {
    return false;
booleanisEmptyString(Collection theCollection)
Returns if the collection contains only empty objects (i.e.
if (theCollection == null) {
    return false;
boolean bReturn = true;
for (T theObject : theCollection) {
    if (!theObject.toString().isEmpty()) {
        bReturn = false;
return bReturn;
booleanisNonEmpty(Collection coll)
is Non Empty
return !isNullOrEmpty(coll);
booleanisNonEmpty(final Collection values)
is Non Empty
return !isEmpty(values);
booleanisNotEmpty(@SuppressWarnings("rawtypes") Collection collection)
is Not Empty
return !isEmpty(collection);