当前位置:网站首页>消除`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");
边栏推荐
- SQL Server(2)
- To solve the problem of "double click PDF file, pop up", please install Evernote program
- 云主机oracle异常恢复----惜分飞
- LeetCode笔记:Weekly Contest 300
- leetcode每日一练:旋转数组
- Oracle recovery tools -- Oracle database recovery tool
- Teamcenter 消息注册前操作或後操作
- 十个顶级自动化和编排工具
- Count the running time of PHP program and set the maximum running time of PHP
- 外盘黄金哪个平台正规安全,怎么辨别?
猜你喜欢

Redis Foundation

Ten capabilities that cyber threat analysts should have

Mongodb (quick start) (I)

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

"Xiaodeng in operation and maintenance" is a single sign on solution for cloud applications

Zabbix

How awesome is the architecture of "12306"?

使用QT遍历Json文档及搜索子对象

mybash

To solve the problem of "double click PDF file, pop up", please install Evernote program
随机推荐
Oracle recovery tools -- Oracle database recovery tool
Vulnerability recurrence - 48. Command injection in airflow DAG (cve-2020-11978)
Abnormal recovery of virtual machine Oracle -- Xi Fenfei
Webapp development - Google official tutorial
Tencent music launched its new product "quyimai", which provides music commercial copyright authorization
MATLAB查阅
如何保存训练好的神经网络模型(pytorch版本)
Leetcode daily question: merge two ordered arrays
Six bad safety habits in the development of enterprise digitalization, each of which is very dangerous!
为什么阳历中平年二月是28天
Disabling and enabling inspections pycharm
What are the changes in the 2022 PMP Exam?
Short the command line via jar manifest or via a classpath file and rerun
“12306” 的架构到底有多牛逼?
Seven Devops practices to improve application performance
「运维有小邓」用于云应用程序的单点登录解决方案
Accuracy of BigDecimal Division
Matlab reference
如何修改mysql字段为自增长字段
This 17-year-old hacker genius cracked the first generation iPhone!