当前位置:网站首页>How to judge null for different types of fields, sets, lists / sets / maps, and objects
How to judge null for different types of fields, sets, lists / sets / maps, and objects
2022-07-24 02:22:00 【Monkey who loves life】
String type :stringutils.isblank("xxx")
It can be judged whether it is null, Is it "", Is it an empty string ( There is a space between the quotes ) Such as : " "
Object type : objects.isNull(User) and objects.nonNull(User)
You can judge the blank of the object , amount to user==null,Java8 Introduced in lambda after , So there are many such filter(Objects::isNull) This way of writing , Obviously than filter(x -> x == null). The method is more intuitive .
List/Set type :CollectionUtils.isEmpty() and CollectionUtils.isNotEmpty
Method can check null And length 0 Of list/set
Map type :MapUtils.isEmpty(map) and MapUtils.isNotEmpty(map)
边栏推荐
- 認識傳輸層協議—TCP/UDP
- Vue3 uses keep alive to cache pages, but every time you switch the tab to enter the page, it will still enter onmounted, resulting in no caching effect. Why?
- 2022-07-22: what is the output of the following go language code? A:1; B:1.5; C: Compilation error; D:1.49。 package main import “fmt“ func main() { var i
- 组件el-scrollbar的使用
- In depth understanding of the underlying framework of wechat applet (II) component system, exprser
- Responsive pbootcms template decoration design website
- On Domain Driven Design
- 145-keep-alive的初步使用
- Resumption: a deck of cards (54), three people fighting the landlord, what is the probability that the big and small kings are in the same family
- Ardunio - ULN2003 drive board and DC motor fan - control fan speed
猜你喜欢

通过Arduino IDE向闪存文件系统上传文件

深入了解-微信开发者工具

View Binding 混淆问题。我两天都在研究混淆。

【MySQL】字符集utf8mb4无法存储表情踩坑记录
![[untitled]](/img/57/a3104833cb5fcc05916075f3bfdaf3.png)
[untitled]

Diablo king, analysis of low illumination image enhancement technology

NetApp FAS系列一个CIFS bug引起的控制器重启案例分享

Opensmile introduction and problems encountered during installation

canvas-绘图(鼠标按下 绘制 抬起 结束)

程序员必备技能----断点调试(IDEA版)
随机推荐
Reconnaître le Protocole de couche de transport - TCP / UDP
Detailed comparison between graphic array and linked list, performance test
jmeter+influxdb+grafana压测实时监控平台搭建
Build a CPU Simulator
微信小程序之性能优化(分包、运行流程细节、精简结构、原生组件通信)
无需编码,自动实现“异步 Request-Reply”模式
Improvement of DB file sequential read caused by insert
Tdengine helps Siemens' lightweight digital solution simicas simplify data processing process
Chapter 9.2 program control of MATLAB
After five years of contact with nearly 100 bosses, as a headhunter, I found that the secret of promotion was only four words
STM32概念和安装【第一天】
Sharing a case of controller restart caused by a CIFS bug in NetApp Fas series
[Luogu] p1318 ponding area
网络协议详解:TCP Part1
深入理解微信小程序的底层框架(二)组件系统、Exparser
输入cnpm -v出现cnpm : 无法加载文件 C:\Users\19457\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
Idea's gradle project Chinese garbled
[untitled]
[C language operation of linked list (initialization, establishment, length calculation, addition, deletion, and output of linked list)]
Wallys/PD-60 802.3AT Input Output802.3AT/AT 85% Efficiency 10/100/1000M GE Surge Protection