标签:stream == als logs lis col blog hot .com
private List<Photo> getChildren(Photo photo) { List<Photo> children = new ArrayList<>(); if (!photoList.isEmpty()) { photoList.stream().filter(child -> photo.getId().equals(child.getParentId())).forEach(child -> { List<Photo> tmp = getChildren(child); child.setChildren(tmp); if (tmp.isEmpty()) { child.setLeaf(true); } Boolean leaf = photo.getLeaf(); Integer parentId = child.getParentId(); if(leaf == null){ Integer childNodes = photoDao.countChildNodes(parentId); if (photo.getText().indexOf("(")==-1) { photo.setText(photo.getText() + "(" + childNodes + ")"); } } children.add(child); }); } return children; }
标签:stream == als logs lis col blog hot .com
原文地址:http://www.cnblogs.com/Java-Starter/p/7735985.html