Here you can find the source of isEmptyOrNull(Object[] array)
public static boolean isEmptyOrNull(Object[] array)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w ww. ja va2 s . c o m * IBM Corporation - initial API and implementation *******************************************************************************/ import java.util.Collection; import java.util.Iterator; public class Main { public static boolean isEmptyOrNull(Object obj) { return (null == obj); } public static boolean isEmptyOrNull(String str) { return (null == str || str.length() == 0); } public static boolean isEmptyOrNull(Object[] array) { return (null == array || array.length == 0); } public static boolean isEmptyOrNull(Object[] array, boolean checkItems) { if (isEmptyOrNull(array)) { return true; } for (Object anArray : array) { if (!isEmptyOrNull(anArray)) { return false; } } return true; } public static boolean isEmptyOrNull(Collection<?> collection) { return (null == collection || collection.size() == 0); } public static boolean isEmptyOrNull(Collection<?> collection, boolean checkItems) { if (isEmptyOrNull(collection)) { return true; } Iterator<?> i = collection.iterator(); while (i.hasNext()) { if (!isEmptyOrNull(i.next())) { return false; } } return true; } public static boolean isEmptyOrNull(byte[] array) { return (null == array || array.length == 0); } }