Java高级开发技巧记录
//对象拷贝
BeanUtils.copyProperties(object, object)
//集合工具
CollectionUtils.isEmpty(list)
List<Long> ids = items.stream().map(p -> p.getId()).collect(Collectors.toList());
list.stream()
.filter(p -> TradeStatus.ONLINE.name().equalsIgnoreCase(p.getTradeStatus()))
.forEach(p -> {
});
//字符串工具
Strings.nullToEmpty(string)
//A|B|C|D|E
List<String> head = Arrays.asList("A", "B", "C", "D", "E");
String rowStr = String.join(separator, head);
//对象工具
Objects.equals(object, object)
Objects.isNull(object)
Objects.nonNull(object)
//日期工具
Date now = DateUtils.truncate(dateTimeHelper.selectDateTime(), Calendar.DAY_OF_MONTH);
String begin = DateFormatUtils.format(DateUtils.addDays(now, -req.getLatestDays()), "yyyyMMdd");
String end = DateFormatUtils.format(DateUtils.addDays(now, -1), "yyyyMMdd");
Date date = "20200101";
DateFormatUtils.format(DateUtils.addDays(date, -1), "yyyyMMdd");
//BigDecimal运算
new BigDecimal(100).divide(new BigDecimal(10000))
//大写
WordUtils.capitalize(profile)
//map遍历
map.entrySet().forEach(entry -> {
});
//线程安全
List<T> list = Collections.synchronizedList(new LinkedList<>());
//AtomicInteger
AtomicInteger count = new AtomicInteger(0);
count.incrementAndGet()
count.intValue()
count.addAndGet(5)
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/19/record-of-advanced-java-development-skills/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Java高级开发技巧记录
//对象拷贝
BeanUtils.copyProperties(object, object)
//集合工具
CollectionUtils.isEmpty(list)
List<Long> ids = items.stream().map(p -> p.ge……
文章目录
关闭
共有 0 条评论