String a="aaaaa"; String b="bbbbb"; String c=null; System.out.println(StrUtil.join(",",a,b,c)); String d= Stream.of(a,b,c).filter(o->!ObjectUtils.isEmpty(o)).collect(Collectors.joining(",")); System.out.println(d);
输出: