Write code to Check if a Collection is not Null And Has Size
//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(notNullAndHasSize(collection)); }//from w ww .j a v a2 s. com public static boolean notNullAndHasSize(Collection<?> collection) { return collection != null && collection.size() > 0; } }