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
As seanizer said above, Apache StringUtils is fantastic for this, if you were to include guava you should do the following;
public List findEmployees(String str, int dep) {
Preconditions.checkState(StringUtils.isNotBlank(str), "Invalid input, input is blank or null");
/** code here **/
}
May I also recommend that you refer to the columns in your result set by name rather than by index, this will make your code much easier to maintain.