Java tutorial
//package com.java2s; import java.util.Collection; import javax.annotation.Nullable; public class Main { /** * Test if a {@link Collection} is empty * * @param <T> * the class of the objects in the list * @param collection * Collection to test * @return true if collection is empty or null * @since 4.2 */ public static <T> boolean isEmpty(@Nullable final Collection<T> collection) { return (collection == null) || collection.isEmpty(); } }