当前位置:网站首页>[Code] if (list! = null & list. Size() > 0) optimization, set empty judgment implementation method
[Code] if (list! = null & list. Size() > 0) optimization, set empty judgment implementation method
2022-07-03 06:39:00 【The gold digger said】
It's old , Write high frequency , I want to change my taste …
this is it : if(list != null && list.size() > 0) ===》 CollectionUtils.isNotEmpty(list);
if (list != null && list.size() > 0) {
//TODO Perform logical
}
//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
if (CollectionUtils.isNotEmpty(list)) {
//TODO Perform logical
}
/** * Collection Tool class * * @author Caratacus * @since 2016-09-19 */
public class CollectionUtils {
/** * Verify that the set is empty * * @param coll Enter the reference * @return boolean */
public static boolean isEmpty(Collection<?> coll) {
return (coll == null || coll.isEmpty());
}
/** * Verify whether the set is not empty * * @param coll Enter the reference * @return boolean */
public static boolean isNotEmpty(Collection<?> coll) {
return !isEmpty(coll);
}
......
}
By way , Elegant expression
边栏推荐
- Support vector machine for machine learning
- Some thoughts on machine learning
- 冒泡排序的简单理解
- Yolov1 learning notes
- How to scan when Canon c3120l is a network shared printer
- Daily question brushing record (11)
- Judge whether the date time exceeds 31 days
- The win7 computer can't start. Turn the CPU fan and stop it
- Use @data in Lombok to simplify entity class code
- 每日刷題記錄 (十一)
猜你喜欢
如何迁移或复制VMware虚拟机系统
Daily question brushing record (11)
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
ruoyi接口权限校验
After the Chrome browser is updated, lodop printing cannot be called
Fluentd facile à utiliser avec le marché des plug - ins rainbond pour une collecte de journaux plus rapide
100000 bonus is divided up. Come and meet the "sister who braves the wind and waves" among the winners
Example of joint use of ros+pytoch (semantic segmentation)
机器学习 | 简单但是能提升模型效果的特征标准化方法(RobustScaler、MinMaxScaler、StandardScaler 比较和解析)
Important knowledge points of redis
随机推荐
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
Luogu problem list: [mathematics 1] basic mathematics problems
[system design] proximity service
Fluentd facile à utiliser avec le marché des plug - ins rainbond pour une collecte de journaux plus rapide
DBNet:具有可微分二值化的实时场景文本检测
Unit test framework + Test Suite
Interesting research on mouse pointer interaction
POI dealing with Excel learning
UNI-APP中条件注释 实现跨段兼容、导航跳转 和 传参、组件创建使用和生命周期函数
[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)
第8章、MapReduce 生产经验
Request weather interface format, automation
error C2017: 非法的转义序列
Mysql database
(翻译)异步编程:Async/Await在ASP.NET中的介绍
Print time Hahahahahaha
JMeter linked database
Learning notes -- principles and comparison of k-d tree and IKD tree
有意思的鼠標指針交互探究
使用conda创建自己的深度学习环境