参考: Guava API
示例:
String m = "Hello"; String n = "World"; System.out.println(StringUtils.strJoiner(";", m, null, n)); // Hello;World or Hello;null;WorldWarning: joiner instances are always immutable; a configuration method such as useForNull has no effect on the instance it is invoked on! You must store and use the new joiner instance returned by the method. This makes joiners thread-safe, and safe to store as static final constants.
警告:joiner 实例总是不可变的;用来定义 joiner 目标语义的配置方法总会返回一个新的 joiner 实例。这使得joiner实例都是线程安全的,你可以将其定义为 static final 常量。