📄 categoryutil.java
字号:
package com.runwit.ebookstore.services.dao;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import com.runwit.ebookstore.model.CategoryModel;
public class CategoryUtil {
// public static class ParentComparator implements Comparator {
// public int compare(Object o1, Object o2) {
// CategoryModel m1 = (CategoryModel)o1;
// CategoryModel m2 = (CategoryModel)o2;
//
// return m1.getParentId() - m2.getParentId();
// }
//
// }
public static List getChildren(List categories, int parent_id) {
List retList = new ArrayList();
if(categories != null) {
Iterator iter = categories.iterator();
while(iter.hasNext()) {
CategoryModel m = (CategoryModel)iter.next();
if(m.getParentId() == parent_id) {
retList.add(m);
}
}
}
return retList;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -