if (itemSn != null && !itemSn.equals("null") && trackingTime.getProductType().equals("Rework") || itemCodeStr.equals("T")) {}
时间: 2024-04-06 17:30:38 浏览: 24
这是一个Java中的if语句,判断条件包括三个部分,用&&和||连接起来。
第一个部分:判断itemSn是否不为null且不等于"null"。如果是,则继续判断第二部分;如果不是,则整个条件判断为false。
第二个部分:判断trackingTime的productType是否等于"Rework"。如果是,则整个条件判断为true;如果不是,则继续判断第三部分。
第三个部分:判断itemCodeStr是否等于"T"。如果是,则整个条件判断为true;如果不是,则整个条件判断为false。
如果整个条件判断为true,则执行if语句后面的代码块。如果整个条件判断为false,则跳过if语句后面的代码块,继续执行下一条语句。
相关问题
isnotBlank和!= null&&"".equals的区别
`isNotBlank`是Apache Commons Lang库中的字符串工具类方法,用于判断一个字符串是否不为空或空格字符,返回值为`true`表示不为空或空格字符,返回值为`false`表示为空或空格字符。例如:
```
StringUtils.isNotBlank(" "); // false
StringUtils.isNotBlank("hello"); // true
StringUtils.isNotBlank(null); // false
```
而`!= null && "".equals`是判断一个字符串不为空并且不为`null`,并且要与空字符串相等时才返回`true`。例如:
```
String str = "hello";
if (str != null && !"".equals(str)) {
// do something
}
```
可以看到,两者的作用略有不同。`isNotBlank`更加严谨,可以同时判断空字符串和空格字符,而`!= null && "".equals`只能判断空字符串。
string != null && !string.equals("")
This is a condition that evaluates to true if the string is not null. In other words, it checks whether the string variable has a value assigned to it or not. If the string is null, the condition would evaluate to false.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)