Do you use StringUtils.EMPTY
instead of ""
?
I mean either as a return value or if you set a the value of a String variable. I don't mean for comparison, because there we use StringUtils.isEmpty()
StringUtils. EMPTY is a final static member of StringUtil class that equates to "" i.e empty String. whereas. StringUtils. isEmpty() Checks if a String is empty ("") or null.
We can check whether a particular String is empty or not, using isBlank() method of the StringUtils class. This method accepts an integer as a parameter and returns true if the given string is empty, or false if it is not.
StringUtils isEmpty = String isEmpty checks + checks for null. StringUtils isBlank = StringUtils isEmpty checks + checks if the text contains only whitespace character(s).
Most common use of StringUtils is in web projects (when you want to check for blank or null strings, checking if a string is number, splitting strings with some token). StringUtils helps to get rid of those nasty NumberFormat and Null exceptions. But StringUtils can be used anywhere String is used.
Of course not. Do you really think "" is not clear enough ?
Constants have essentially 3 use cases:
None apply here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With