style: 适配 Java 11 新 API

1.对 Optional 的 isPresent() 取反用法 => isEmpty()
2.集合 toArray(new String[0]) 用法 => toArray(String[]::new)
This commit is contained in:
2023-03-31 22:46:14 +08:00
parent 74e61a0111
commit 5a5bd1681e
2 changed files with 12 additions and 6 deletions

View File

@@ -200,14 +200,14 @@ public class MailUtils {
// 设置收信人
// 抄送人
if (CollUtil.isNotEmpty(ccs)) {
messageHelper.setCc(ccs.toArray(new String[0]));
messageHelper.setCc(ccs.toArray(String[]::new));
}
// 密送人
if (CollUtil.isNotEmpty(bccs)) {
messageHelper.setBcc(bccs.toArray(new String[0]));
messageHelper.setBcc(bccs.toArray(String[]::new));
}
// 收件人
messageHelper.setTo(tos.toArray(new String[0]));
messageHelper.setTo(tos.toArray(String[]::new));
// 设置附件
if (ArrayUtil.isNotEmpty(files)) {