当前位置:网站首页>消除`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");
边栏推荐
- 为什么阳历中平年二月是28天
- Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
- Leetcode daily question: merge two ordered arrays
- 怎么选择外盘期货平台最正规安全?
- QT console printout
- Elk log analysis system
- EPM related
- Use QT designer interface class to create two interfaces, and switch from interface 1 to interface 2 by pressing the key
- How to modify MySQL fields as self growing fields
- 一文读懂简单查询代价估算
猜你喜欢

Configure pytorch environment in Anaconda - win10 system (small white packet meeting)

ISPRS2022/云检测:Cloud detection with boundary nets基于边界网的云检测

神经网络自我认知模型

Ten top automation and orchestration tools

Cmake tutorial step1 (basic starting point)

基于YOLOv3的口罩佩戴检测

EPM相关

nacos -分布式事务-Seata** linux安装jdk ,mysql5.7启动nacos配置ideal 调用接口配合 (保姆级细节教程)

修复漏洞 - mysql 、es

云主机oracle异常恢复----惜分飞
随机推荐
QT控制台打印输出
论文阅读_中文NLP_LTP
mybash
rsync
检查命名空间和类
Leetcode daily question: merge two ordered arrays
tkinter窗口预加载
Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!
7 pratiques devops pour améliorer la performance des applications
The comprehensive competitiveness of Huawei cloud native containers ranks first in China!
SQL Server(2)
ITK Example
This 17-year-old hacker genius cracked the first generation iPhone!
mybash
十个顶级自动化和编排工具
Oracle recovery tools -- Oracle database recovery tool
开户复杂吗?网上开户安全么?
Data access - entityframework integration
LeetCode每日一题:合并两个有序数组
"Xiaodeng in operation and maintenance" is a single sign on solution for cloud applications