How can I check whether a string is not null and not empty?
public void doStuff(String str) { if (str != null && str != \"**here I want to check
I like to use Apache commons-lang for these kinds of things, and especially the StringUtils utility class:
import org.apache.commons.lang.StringUtils; if (StringUtils.isNotBlank(str)) { ... } if (StringUtils.isBlank(str)) { ... }