/** * 对按ip缩容的容器列表按分组分类 * 返回的数据结构为 * key : 分组1 value: [obj,obj,obj] * @param list * @return */ public Map<String,Integer> sortIps(List<DestroyItem> list){ TreeMap tm=new TreeMap(); if(CollectionUtils.isNotEmpty(list)){ for (DestroyItem item:list) { //如果包含key if(tm.containsKey(item.getAppGroup())){ ArrayList currentList=(ArrayList)tm.get(item.getAppGroup()); currentList.add(item); }else{ ArrayList itemList=new ArrayList(); itemList.add(item); tm.put(item.getAppGroup(), itemList); } } } return tm; }
对list进行分类
最新推荐文章于 2023-11-21 22:34:55 发布