Java – null and stringutils Differences between isblank()
•
Java
I want to check whether a string is empty. I want to know which of the following is better, which is better and under which circumstances
In particular, this error occurs when I use "isnotblank": "cannot convert to Java. Lang. string"
this.text.getData() != null <--- works perfectly fine. StringUtils.isNotBlank((String)this.text.getData()) <- doesn't work.
If "null" is not the best solution, what can I use?
Solution
If you want any non null data to be a string
If 'data' can be an object of a certain type, then stringutils is not the correct solution at all and null check is the correct approach!
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码