一.数组、List
1. String[] 转 int[]
String menus_ = "1,2,3,4,5";
String[] sarr = menus_.split(",");
int[] menuIdArrs = Arrays.stream(sarr).mapToInt(Integer::parseInt).toArray();
2.List 转 数组
ArrayList<String> list=new ArrayList<String>(); String[] strings = new String[list.size()]; list.toArray(strings);
3.String[] 转 List
String[] s = {"a","b","c"}; List list = Arrays.asList(s);
4.List<String> 转 String
List<String> strList = [1, 2, 3]; String str = String.join(",",strList );
5.String 转 List<Integer>
String str = "1,2,3" List<String> isStr =Arrays.asList(str.split(",")); List<Integer> isInt = new ArrayList<>(); CollectionUtils.collect(isStr, new Transformer() { @Override public Object transform(Object obj) { return Integer.valueOf(obj.toString()); }},isInt);