I render some data based on a condition. The backing method performs a check if a string exists. But I don’t know if I can be happy with the compare to null?
public boolean isString(MyClass var) {
return null != var.getMyString();
}
Could it be done better?
I like
StringUtils.isNotBlank()from Apache Commons Lang:It performs extra
trim()which is desirable most of the time. If not, useStringUtils.isNotEmpty(). Another advantage: it usesCharSequenceso you can passString,StringBuilder, etc.