All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.chrlembeck.util.collections.CollectionsUtil Maven / Gradle / Ivy

The newest version!
package de.chrlembeck.util.collections;

import java.util.Collection;

/**
 * Some utility methods around any kinds of collections.
 * 
 * @author Christoph Lembeck
 */
@SuppressWarnings("PMD.UseUtilityClass")
public class CollectionsUtil {

    /**
     * Checks, if the collection is null or empty.
     * 
     * @param collection
     *            Collection to be checked.
     * @return {@code true} if the collection is {@code null} or empty, {@code false} if it is not null and contains any
     *         data.
     * @param 
     *            Type of the elements in the collection.
     * @see Collection#isEmpty()
     */
    public static  boolean isNullOrEmpty(final Collection collection) {
        return collection == null || collection.isEmpty();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy