Here you can find the source of nullOrEmpty(Collection> coll)
public final static boolean nullOrEmpty(Collection<?> coll)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Map; public class Main { /**/*from w ww . j av a2s.co m*/ * (S is null) OR ( S is empty) * * Empty in the sense of only white space content. * * @param s * * @return ((s==null)) ∨ (s.isEmpty()) */ public final static boolean nullOrEmpty(String s) { return !notNullAndEmpty(s); } public final static boolean nullOrEmpty(Collection<?> coll) { return coll == null || coll.isEmpty(); } public final static boolean nullOrEmpty(Map<?, ?> coll) { return coll == null || coll.isEmpty(); } /** * (S is not null) AND ( S is not empty) * * Empty in the sense of not white space content. * * @param s * * @return (!(s==null)) ∧ (!s.isEmpty()) */ public final static boolean notNullAndEmpty(String s) { if (s == null) return false; if (s.trim().length() <= 0) return false; return true; } public final static boolean notNullAndEmpty(Collection<?> coll) { return coll != null && !coll.isEmpty(); } public final static boolean notNullAndEmpty(Map<?, ?> coll) { return coll != null && !coll.isEmpty(); } }