当前位置:网站首页>消除`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");
边栏推荐
- Configure pytorch environment in Anaconda - win10 system (small white packet meeting)
- Simple query cost estimation
- 2022新版PMP考试有哪些变化?
- Disabling and enabling inspections pycharm
- Mongodb (quick start) (I)
- "Xiaodeng in operation and maintenance" is a single sign on solution for cloud applications
- Leetcode daily question: merge two ordered arrays
- 删除数组中的某几个元素
- Cartoon: interesting pirate problem (full version)
- Action avant ou après l'enregistrement du message teamcenter
猜你喜欢
Career advancement Guide: recommended books for people in big factories
解决“双击pdf文件,弹出”请安装evernote程序
Thesis reading_ Medical NLP model_ EMBERT
“12306” 的架构到底有多牛逼?
云主机oracle异常恢复----惜分飞
Short the command line via jar manifest or via a classpath file and rerun
Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
MATLAB查阅
Knowledge points of MySQL (6)
Configure pytorch environment in Anaconda - win10 system (small white packet meeting)
随机推荐
钉钉开放平台小程序API的缓存接口都有哪些内容?
怎么选择外盘期货平台最正规安全?
请问下为啥有的表写sql能查到数据,但在数据地图里查不到啊,查表结构也搜不到
在一台服务器上部署多个EasyCVR出现报错“Press any to exit”,如何解决?
寻找第k小元素 前k小元素 select_k
Cmake tutorial Step4 (installation and testing)
求解为啥all(())是True, 而any(())是FALSE?
Tkinter window preload
LeetCode每日一题:合并两个有序数组
如何保存训练好的神经网络模型(pytorch版本)
matlab内建函数怎么不同颜色,matlab分段函数不同颜色绘图
Anaconda中配置PyTorch环境——win10系统(小白包会)
Is it safe to open an account online? What is the general interest rate of securities financing?
Disorganized series
开户复杂吗?网上开户安全么?
Matlab reference
职场进阶指南:大厂人必看书籍推荐
Elk log analysis system
神经网络自我认知模型
RSE2020/云检测:基于弱监督深度学习的高分辨率遥感图像精确云检测