【发布时间】:2012-09-20 23:36:37
【问题描述】:
我正在使用以下代码将对象列表保存在 MAP 中,
Map<String, List<Rows>> map = new HashMap<String, List<Rows>>()
while( rs.next() ) {
Rows row = new Rows();
/*
* code to initialize the values of row from the record
*/
String category = rs.getString("Cat");
if(!map.containsKey(category)){
map.put(category, new ArrayList<Rows>());
}
map.get(category).add(row);
}
是否可以对每个类别的值进行排序? 如何删除特定类别中的项目?
【问题讨论】:
-
您想对每个类别的值 ArrayList
进行排序,对吗? -
这就是为什么在你上一篇文章中我要求你使用 Map of Map stackoverflow.com/questions/12650122/…