员工管理-遍历(递归)
来源:互联网 发布:梦幻西游mac版是什么 编辑:程序博客网 时间:2024/05/23 23:09
搜索某个节点一下的所有某个名字的子节点
写了个递归
<pre name="code" class="java"><span style="font-family: Monaco;">private List<User> getAllChildren(String tel) {</span>
List allChildren = new ArrayList();List temp = findChildren(tel);//获得某人的所有直属下级if (temp.size() == 0) {return allChildren;}for (int i = 0; i < temp.size(); i++) {allChildren.add((User) temp.get(i));allChildren.addAll(getAllChildren(((User) temp.get(i)).getTel()));}return allChildren;}public List<User> searchByUsername(String username, String usertel) {List list = new ArrayList();List allChildren = getAllChildren(usertel);for (int i = 0; i < allChildren.size(); i++) {if (((User) allChildren.get(i)).getUsername().equals(username)) {list.add((User) allChildren.get(i));}}return list;}
0 0
- 员工管理-遍历(递归)
- 员工管理(JDBC)
- 员工管理系统(完整版)
- 员工管理系统(ArrayList)
- 员工管理系统(三层)
- 员工管理
- 员工管理
- 员工管理
- 员工管理
- file遍历(递归)
- 图的遍历(深度递归遍历,深度非递归遍历,广度递归遍历)
- 二叉树遍历(递归,非递归)
- 二叉树中序遍历(递归+非递归)
- 树的遍历(递归、非递归)
- 员工管理 (学习笔记) 1
- 第6章 职员(员工)管理
- 第6章 职员(员工)管理
- Java员工管理系统(控制台输出)
- 阿里云服务器或者其他网站绑定域名方法
- tableview设置header
- 互联网年鉴
- 构建完整的机器人应用系统
- hihoCoder 1228 Mission Impossible 6 2015北京网络赛 大模拟
- 员工管理-遍历(递归)
- http协议
- 潘鹏整理WPF(5)滚动条ScrollViewer
- linux syscon and regmap study note
- google如何恢复误删除书签
- 23设计模式之组合模式(Composite)
- OCP-V13-702
- java注解(1)
- 【软考之路】操作系统—进程