if (first != null && second != null && !first.equals(second)) {
// not null & not equal
} else if (first == null ^ second == null) {
// not both null and not both not null
// (first == null && second != null) || (first != null && second == null)
} else {
// both null or equal
}
Run Code Online (Sandbox Code Playgroud)
FindBugs抱怨else if(first == null ^ second == null){...}
| 归档时间: |
|
| 查看次数: |
3568 次 |
| 最近记录: |