StringUtils empty check Jan 3, 2017 We often would check if a String object is null or empty, so here is the code snippet public static boolean isEmpty(String s) { return s==null||s.trim().length()==0; } public static boolean isNotEmpty(String s) { return !isEmpty(s); } /** * check if all params is empty */ public static boolean isNotEmpty(String ... params) { boolean foundEmpty = false; for(String param:params) { if(isEmpty(param)) { foundEmpty = true; break; } } if(!foundEmpty) { return true; } return false; }