Java中将List<String>转化为以,分割的字符串或相反(转载)

  • 将逗号分隔的字符串转换为List
List list = Arrays.asList(str.split(","));
List list = Arrays.asList(StringUtils.split(str, ","));
  • 将list转化为逗号分割的字符串
String str = String.join(",", list);
String str = StringUtils.join(list.toArray(), ",");

你可能感兴趣的:(java基础)