1、String 与 list 相互转换

List<String> str = new ArrayList<>();
str.add("small");str.add("sun");str.add("shine");
String joinStr = String.join(",", str);
System.out.println("joinStr=====>>" + joinStr);
List<String> strList = Arrays.asList(joinStr.split(","));
System.out.println("strList====>>"+JSON.toJSONString(strList));

 2、输出:

joinStr=====>>small,sun,shine
strList====>>["small","sun","shine"]

 

相关文章:

  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
相关资源
相似解决方案