数组→字符串(逗号隔开)
StringUtils.join(arr, ",")
字符串→数组
String str="000,111,222"
String[] arr=str.split(",");//在逗号处进行切割成数组
//arr为[000,111,222]
List→字符串,逗号隔开
List<String> names=new ArrayList<>();
names.add("张三");
names.add("李四");
String name = names.stream().map(String::valueOf).collect(Collectors.joining(","));
System.out.println(name);//输出 张三,李四
List→字符串(逗号隔开)
List<String> names=new ArrayList<>();
names.add("张三");
names.add("李四");
String name = names.stream().map(String::valueOf).collect(Collectors.joining(","));
System.out.println(name);//输出 张三,李四
数组→集合
List<String> list = Arrays.asList(数组);
类→字符串
Gson gson = new Gson();
String str = gson.toJson(实体类);
字符串→类
类 a = JSON.parseObject(字符串, 类.class);