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
You should use org.apache.commons.lang3.StringUtils.isNotBlank()
or org.apache.commons.lang3.StringUtils.isNotEmpty
. The decision between these two is based on what you actually want to check for.
The isNotBlank() checks that the input parameter is:
The isNotEmpty() checks only that the input parameter is