Map转化为List
List<JfAuction> jfAuctionListValue=null; if(jfAuctionList!=null && jfAuctionList.size()>0){ Map<Integer, JfAuction> jfAuctionMap = new HashMap<Integer, JfAuction>(); for(JfAuction jfAuction:jfAuctionList){ if (jfAuctionMap.get(jfAuction.getUser().getId()) == null) { // 如果没有此类型,则添加此类型的数值 jfAuctionMap.put(jfAuction.getUser().getId(), jfAuction); }else{ // 如果有此类型,则把此类型的数值修改为-->原来的数值+新数值,实现类似sum功能 Integer sum=jfAuction.getScore()+jfAuctionMap.get(jfAuction.getUser().getId()).getScore(); jfAuction.setScore(sum); jfAuctionMap.put(jfAuction.getUser().getId(), jfAuction); } }
}