当前位置:网站首页>[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
边栏推荐
- 2022 cisp-pte (III) command execution
- 爬虫代码基础教学
- pytorch练习小项目
- Docker advanced learning (container data volume, MySQL installation, dockerfile)
- Operation principle of lua on C: Foundation
- How to scan when Canon c3120l is a network shared printer
- SQL implementation merges multiple rows of records into one row
- Creating postgre enterprise database by ArcGIS
- Interesting research on mouse pointer interaction
- The win7 computer can't start. Turn the CPU fan and stop it
猜你喜欢

Scripy learning

Redis cluster creation, capacity expansion and capacity reduction

After the Chrome browser is updated, lodop printing cannot be called

有意思的鼠標指針交互探究

HMS core helps baby bus show high-quality children's digital content to global developers

10万奖金被瓜分,快来认识这位上榜者里的“乘风破浪的姐姐”

Numerical method for solving optimal control problem (I) -- gradient method

Local rviz call and display of remote rostopic

vmware虚拟机C盘扩容

每日刷题记录 (十一)
随机推荐
Nacos service installation
Yolov3 learning notes
Operation principle of lua on C: Foundation
Ruoyi interface permission verification
Reinstalling the system displays "setup is applying system settings" stationary
有意思的鼠標指針交互探究
Cannot get value with @value, null
Docker advanced learning (container data volume, MySQL installation, dockerfile)
Create your own deep learning environment with CONDA
这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意
[C /vb.net] convert PDF to svg/image, svg/image to PDF
[set theory] equivalence relation (concept of equivalence relation | examples of equivalence relation | equivalence relation and closure)
2022年华东师范大学计科考研复试机试题-详细题解
Install VM tools
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
【类和对象】深入浅出类和对象
简易密码锁
Mysql
opencv
Mysql database