Here you can find the source of isNullOrEmpty(final Object obj)
@SuppressWarnings("unchecked") public static boolean isNullOrEmpty(final Object obj)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { @SuppressWarnings("unchecked") public static boolean isNullOrEmpty(final Object obj) { if (obj == null) { return true; }//from ww w. j a va 2 s . c om if (obj.getClass().equals(Collection.class)) { return ((Collection) obj).size() == 0; } else { if (obj.toString().trim().length() == 0) { return true; } } return false; } }