String roleId = "1,2,3";
String[] roleIds = roleId.split(",");
//数组转List
List roleList = Arrays.asList(roleIds);
//查询父节点的角色Id
List<String> parentIds = uaRoleDao.queryParentFunId(paramMap);
//将集合转换成数组
String[] parentArray = (String[]) parentIds.toArray(new String[parentIds.size()]);
if(parentIds!=null&&parentIds.size()>0){
//扩容
functions = Arrays.copyOf(functions, functions.length+parentArray.length);
//拷贝数组到functions
System.arraycopy(parentArray, 0, functions, functions.length-parentArray.length, parentArray.length);
}
数组转list,list转数组、数组扩容、数组复制方法
最新推荐文章于 2024-03-30 04:56:51 发布