当前位置:网站首页>Eliminate the writing of 'if () else{}'
Eliminate the writing of 'if () else{}'
2022-07-05 17:57:00 【Edric_ Howe】
- If
personThe name of is empty , Then perform business assignment ID
Person person = new Person();
Optional.ofNullable(person..getName()).ifPresent(p->p.setId(1))
- If
personIf the name of is not empty, the name , Otherwise return to2
String test = Optional.ofNullable(person.getName()).orElse("2");
边栏推荐
猜你喜欢

Seven Devops practices to improve application performance

How awesome is the architecture of "12306"?

解决“双击pdf文件,弹出”请安装evernote程序

Short the command line via jar manifest or via a classpath file and rerun

Zabbix

7 pratiques devops pour améliorer la performance des applications

ELK日志分析系统

Cmake tutorial Step2 (add Library)

Abnormal recovery of virtual machine Oracle -- Xi Fenfei

服务器配置 jupyter环境
随机推荐
提高應用程序性能的7個DevOps實踐
ELK日志分析系统
Is it safe to open an account online? What is the general interest rate of securities financing?
"Xiaodeng in operation and maintenance" is a single sign on solution for cloud applications
Count the running time of PHP program and set the maximum running time of PHP
登录连接 CDB 和 PDB
职场进阶指南:大厂人必看书籍推荐
Neural network self cognition model
PMP认证需具备哪些条件啊?费用多少啊?
EPM related
Tencent music launched its new product "quyimai", which provides music commercial copyright authorization
Cmake tutorial Step4 (installation and testing)
Easynmon Usage Summary
Why is all (()) true and any (()) false?
请问下为啥有的表写sql能查到数据,但在数据地图里查不到啊,查表结构也搜不到
企业数字化发展中的六个安全陋习,每一个都很危险!
求解为啥all(())是True, 而any(())是FALSE?
读libco保存恢复现场汇编代码
mybash
Leetcode exercise - 206 Reverse linked list