Java examples for Collection Framework:Array Element Filter
Test if entities array is empty.
//package com.java2s; public class Main { public static void main(String[] argv) { Object[] entities = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; System.out.println(isEmpty(entities)); }/*from w w w . j a va 2s . c o m*/ /** Test if entities array is empty. * * @param entities to test if it is empty. * @return true if entities array is null or entities array length is zero. */ public static boolean isEmpty(Object[] entities) { return entities == null || (entities != null && entities.length == 0); } }