In the project, we mostly use the non empty judgment method in stringutils. I believe most people have used the isnotempty or isempty method
public static Boolean isnotempty (string STR)
to judge whether a string is non empty, equal to! Isempty (string STR), where the space character cannot be excluded
Public static Boolean isnotblank (string STR)
to determine whether a string is not empty, its length is not 0, and it is not composed of whitespace! isBlank(String str)
Therefore, in many business logics, isnotblank is better than isnotempty. One is to judge whether the string is not empty and the length is not 0, and it is not composed of whitespace
isNullOrEmpty
StringUtils.IsNullOrEmpty(null) = true
StringUtils.IsNullOrEmpty("") = true
StringUtils.IsNullOrEmpty(" ") = true
StringUtils.IsNullOrEmpty("12345") = false
StringUtils.IsNullOrEmpty(" 12345 ") = false
When doing a query: List detail = systemService.findListbySql(getNewDataId);
Determine if it is emptyif (!ListUtils.isNullOrEmpty(detail)) {}
Read More:
- Java uses single thread pool to realize multi thread sequential execution (non alternating, non synchronous)
- Abstract method and static method of java interface
- [Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty
- Comparison method violates its general contract [How to Solve]
- [Solved] error: method does not override or implement a method from a supertype
- JAVA: How to use the third-party font library method (using the third-party TTF / TTC font library method)
- [Solved] Method threw ‘java.lang.StackOverflowError‘ exception. Cannot evaluate
- Tensorflow Error raise RuntimeError(‘The Session graph is empty. Add operations to the ‘ RuntimeError:
- The difference between Scanner.next() and Scanner.nextLine()
- Mapper.xml Error: Error setting non null for parameter #3 with JdbcType null.
- Flink Error: is not serializable. The object probably contains or references non serializable fields.
- Java: How to Find the Minimum Value from a Random Array by Bubble Sort Method
- [Solved] “status“:405,“error“ Request method ‘POST‘ not supported“
- Asynchronous processing of HTTP request by Java_ Method 1: through callable
- Asynchronous processing of HTTP request by Java_ Method 2: through deferredresult
- [Solved] Mvel2 Error: java.lang.VerifyError method: getKnownEgressType signature
- Java Web uses AJAX POST Method 405 terror [Solved]
- Build a mybatis and it will appear session.selectOne Method error
- [Solved] Error creating bean with name ‘mvcContentNegotiationManager‘: Lookup method resolution failed
- [Solved] Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: