Here you can find the source of isNullOrEmpty(Object object, boolean zeroEqualsEmpty)
private final static boolean isNullOrEmpty(Object object, boolean zeroEqualsEmpty)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**/* w w w . j ava 2 s. c o m*/ * Returns true if the object specified is null or empty (e.g., an empty * string, or an empty collection) * * @param object the object to check * @return true if the text specified is null or empty, false otherwise */ public final static boolean isNullOrEmpty(Object object) { return (isNullOrEmpty(object, false)); } private final static boolean isNullOrEmpty(Object object, boolean zeroEqualsEmpty) { if (object == null) return true; if (object instanceof Collection) return ((Collection) object).size() == 0; else if (object instanceof Map) return ((Map) object).size() == 0; else if (object.getClass().isArray()) return ((Object[]) object).length == 0; else if (object instanceof Number && zeroEqualsEmpty) return ((Number) object).longValue() == 0; else return object.toString().length() == 0; } }