List排序
来源:互联网 发布:人工智能电影特点评价 编辑:程序博客网 时间:2024/06/06 22:12
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Collections.sort(list, new Comparator<Map<String,Object>>(){ public int compare(Map<String, Object> o1, Map<String, Object> o2) { int b1 = (Integer) o1.get("items_sold"); int b2 = (Integer)o2.get("items_sold"); if (b1>b2) { return -1; }else if(b1==b2){ return 0; }else{ return 1; } } });当List中是个Map,new Comparator时也要加上,否则参数类型不匹配。
0 0
- List排序
- list 排序
- list排序...
- List排序
- List 排序
- List排序
- LIST排序
- list排序
- List 排序
- list排序
- LIST 排序
- List 排序
- List排序
- list排序
- List排序
- List 排序
- List排序
- List排序
- 5 步助你成为一名优秀的 Docker 代码贡献者
- window.location.href在IE6上面竟然不跳转
- Yii中处理前后台登录
- cmd.exe 的位置和打开方式
- c++中的引用
- List排序
- Lintcode(6)-最长公共前缀
- 物理引擎使用-感悟
- 洞悉Linux系统软硬件配置-aspersa
- 代码实现 Autolayout
- 百度地图开发界面出现格网
- OC下NSLog的格式输出对照表
- HTTP API选择WinInet or WinHttp?
- Swift函数