Write code to Check whether a collection is empty or null.
//package com.book2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection collection = java.util.Arrays.asList("asdf", "book2s.com"); System.out.println(isEmptyOrNull(collection)); }//from w ww .j a v a2 s . c om /** * Checks whether a collection is empty or null.<p> * * @param collection a collection * @return true if <code>collection</code> is <code>null</code> or empty. */ public static boolean isEmptyOrNull(Collection<?> collection) { return (collection == null) || collection.isEmpty(); } }