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"]