当前位置:网站首页>消除`if()else{ }`写法
消除`if()else{ }`写法
2022-07-05 17:47:00 【Edric_豪】
- 如果
person
的名称为空,则执行业务赋值ID
Person person = new Person();
Optional.ofNullable(person..getName()).ifPresent(p->p.setId(1))
- 如果
person
的名称不为空则返回名称,否则返回2
String test = Optional.ofNullable(person.getName()).orElse("2");
边栏推荐
- Independent development is a way out for programmers
- ISPRS2022/雲檢測:Cloud detection with boundary nets基於邊界網的雲檢測
- Cartoon: interesting pirate problem (full version)
- Data access - entityframework integration
- mybash
- 基于YOLOv3的口罩佩戴检测
- MATLAB查阅
- Redis Foundation
- Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
- ISPRS2022/云检测:Cloud detection with boundary nets基于边界网的云检测
猜你喜欢
Count the running time of PHP program and set the maximum running time of PHP
IDC report: Tencent cloud database ranks top 2 in the relational database market!
Zabbix
Thesis reading_ Chinese NLP_ LTP
mybash
Six bad safety habits in the development of enterprise digitalization, each of which is very dangerous!
LeetCode每日一题:合并两个有序数组
使用QT遍历Json文档及搜索子对象
Unicode processing in response of flash interface
ELK日志分析系统
随机推荐
Compared with the loss of Wenxin, the performance is improved a lot
集群部署如何解决海量视频接入与大并发需求?
登录连接 CDB 和 PDB
VBA drives SAP GUI to realize office automation (II): judge whether elements exist
Easynmon Usage Summary
Action avant ou après l'enregistrement du message teamcenter
寻找第k小元素 前k小元素 select_k
GFS distributed file system
2022新版PMP考试有哪些变化?
Accuracy of BigDecimal Division
Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
在一台服务器上部署多个EasyCVR出现报错“Press any to exit”,如何解决?
论文阅读_医疗NLP模型_ EMBERT
Oracle recovery tools -- Oracle database recovery tool
rsync
请问下为啥有的表写sql能查到数据,但在数据地图里查不到啊,查表结构也搜不到
如何保存训练好的神经网络模型(pytorch版本)
To solve the problem of "double click PDF file, pop up", please install Evernote program
Please tell me why some tables can find data by writing SQL, but they can't be found in the data map, and the table structure can't be found
Disabling and enabling inspections pycharm