if(spec.getVolumeSpecs() == null || spec.getVolumeSpecs().size() ==0 || spec.getVolumeSpecs().get(0) == null || spec.getVolumeSpecs().get(0).getPrimaryStorageInventory() == null){
return;
}
if(spec.getVolumeSpecs() == null || spec.getVolumeSpecs().size() ==0 || spec.getVolumeSpecs().get(0) == null || spec.getVolumeSpecs().get(0).getPrimaryStorageInventory() == null){
return;
}
|
letitbesqzrMay 9, 2017
1
前两个判断随便找个工具类:
spec.getVolumeSpecs() == null || spec.getVolumeSpecs().size() ==0 ->CollectionUtil.isEmpty(spec.getVolumeSpecs()) spec.getVolumeSpecs().get(0) == null 没有意义 spec.getVolumeSpecs().get(0).getPrimaryStorageInventory() == null 看你业务是否有这个必要 |
|
SoloCompanyMay 9, 2017 via iPhone
2
?语法糖的最佳使用场景
只不过 java 没有😏 |
|
3
@SoloCompany 请问什么语言有?
|
|
MichaelssssMay 15, 2017
4
。。。。。。。这个时候不就是自己写个 Utils 的最佳实践么。。。
|
|
UncleRiverMay 17, 2017
5
|
|
sonyxperiaMay 18, 2017
6
写个通用的 util
抽取成一个方法 |