StringUtils
1.判断是否为空,返回boolean:
StringUtils.isEmpty(String str)
2.判断是否非空,返回boolean:
StringUtils.isNotEmpty(String str)
3.判断空白,返回boolean:
StringUtils.isBlank(String str)
4.判断非空白,返回boolean:
StringUtils.isNotBlank(String str)
empty和blank的区别
isEmpty 等价于 str == null || str.length == 0
isBlank 等价于 str == null || str.length == 0 || str.trim().length == 0
isNotEmpty等价于 a != null && a.length > 0
isNotBlank 等价于 a != null && a.length > 0 && str.trim().length > 0
CollectionUtils
1.判断集合是否为空
CollectionUtils.isEmpty(Collection<?> coll) 2.判断集合是否不为空 CollectionUtils.isNotEmpty(Collection<?> coll)
List<ConDailyLogConstructorPO> result = baseMapper.selectList(test);
if(CollectionUtils.isNotEmpty(result)){
List<Long> collect = result.stream().map(ConDailyLogConstructorPO::getId).collect(Collectors.toList());
}