当前位置:网站首页>[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
边栏推荐
- In depth analysis of kubernetes controller runtime
- The most classic 100 sentences in the world famous works
- Daily question brushing record (11)
- conda和pip的区别
- Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
- golang操作redis:写入、读取kv数据
- 2022 cisp-pte (III) command execution
- SQL实现将多行记录合并成一行
- Unit test framework + Test Suite
- 数值法求解最优控制问题(一)——梯度法
猜你喜欢

【无标题】

Create your own deep learning environment with CONDA

每日刷題記錄 (十一)

100000 bonus is divided up. Come and meet the "sister who braves the wind and waves" among the winners

使用conda创建自己的深度学习环境

利用C#实现Pdf转图片

Yolov1 learning notes

2022 CISP-PTE(三)命令执行
![[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)](/img/a4/00aca72b268f77fe4fb24ac06289f5.jpg)
[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)

After the Chrome browser is updated, lodop printing cannot be called
随机推荐
Mysql5.7 group by error
Une exploration intéressante de l'interaction souris - pointeur
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
【类和对象】深入浅出类和对象
Use selenium to climb the annual box office of Yien
Scripy learning
Click cesium to obtain three-dimensional coordinates (longitude, latitude and elevation)
冒泡排序的简单理解
Judge whether the date time exceeds 31 days
使用conda创建自己的深度学习环境
每日刷题记录 (十一)
JMeter performance automation test
机器学习 | 简单但是能提升模型效果的特征标准化方法(RobustScaler、MinMaxScaler、StandardScaler 比较和解析)
机械观和系统观的科学思维方式各有什么特点和作用
Yolov2 learning and summary
Scroll view specifies the starting position of the scrolling element
Shell conditional statement
Machine learning | simple but feature standardization methods that can improve the effect of the model (comparison and analysis of robustscaler, minmaxscaler, standardscaler)
2022 cisp-pte (III) command execution
[untitled] 5 self use history