List<Function> resultFunctionList = new ArrayList<Function>();
List<Function> functionListTemp = new ArrayList<Function>();
Subject currentUser = SecurityUtils.getSubject();
User user = (User) currentUser.getPrincipal();
List<Function> functionList = user.getFunctionList();
functionListTemp = new ArrayList<Function>(functionList);
Iterator<Function> iterator = functionListTemp.iterator();
for (Function parent : functionListTemp) {
if (oid.equals(parent.getOid())) {
resultFunctionList.add(parent);
for (Function child : functionListTemp) {
if (child.getPid().equals(parent.getOid())) {
if (parent.getChildren() == null) {
parent.setChildren(new ArrayList<Function>());
}
parent.getChildren().add(child);
}
}
}
}
return resultFunctionList;
parent.getChildren().add(child) 居然会改变functionList对象中的内容