Java examples for java.util:Collection Element
Check if Collection has Elements
//package com.java2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection collection = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(hasElements(collection)); }/*from ww w. ja v a 2s .c o m*/ public static boolean hasElements(Collection<?> collection) { return collection != null && !collection.isEmpty(); } }