Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

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)
上一篇 Java判断IP地址是否在CIDR范围内
下一篇 基于JWT的token身份认证方案