当前位置:网站首页>Eliminate the writing of 'if () else{}'
Eliminate the writing of 'if () else{}'
2022-07-05 17:57:00 【Edric_ Howe】
- If
person
The name of is empty , Then perform business assignment ID
Person person = new Person();
Optional.ofNullable(person..getName()).ifPresent(p->p.setId(1))
- If
person
If the name of is not empty, the name , Otherwise return to2
String test = Optional.ofNullable(person.getName()).orElse("2");
边栏推荐
- 破解湖+仓混合架构顽疾,星环科技推出自主可控云原生湖仓一体平台
- [BeanShell] there are many ways to write data locally
- 提高应用程序性能的7个DevOps实践
- 通过SOCKS代理渗透整个内网
- How awesome is the architecture of "12306"?
- IDC report: Tencent cloud database ranks top 2 in the relational database market!
- 使用QT遍历Json文档及搜索子对象
- The five most difficult programming languages in the world
- Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!
- QT console printout
猜你喜欢
随机推荐
Sentinel-流量防卫兵
GFS分布式文件系统
检查命名空间和类
統計php程序運行時間及設置PHP最長運行時間
Cmake tutorial Step4 (installation and testing)
Thesis reading_ Medical NLP model_ EMBERT
ISPRS2022/雲檢測:Cloud detection with boundary nets基於邊界網的雲檢測
Delete some elements in the array
Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!
GIMP 2.10教程「建议收藏」
MATLAB查阅
LeetCode每日一题:合并两个有序数组
Sophon CE社区版上线,免费Get轻量易用、高效智能的数据分析工具
Read libco save and restore the on-site assembly code
ITK Example
leetcode每日一题:字符串中的第一个唯一字符
Seven Devops practices to improve application performance
Tencent music launched its new product "quyimai", which provides music commercial copyright authorization
云主机oracle异常恢复----惜分飞
Anaconda中配置PyTorch环境——win10系统(小白包会)