DNS解析错误-ping request could not find host
2015-05-12 12:43
274 查看
今天同事遇到一个问题,需要在List中存放Map,每个map只存储一对值。
需要按值排序。
勾起了记忆深处的java 比较器。这玩意不常用,估计很多人都没怎么用过。
觉得有点意思,特意贴出来。
需要按值排序。
勾起了记忆深处的java 比较器。这玩意不常用,估计很多人都没怎么用过。
觉得有点意思,特意贴出来。
Public class Test{ public void test(){ List<Map<String,Integer>> list = new ArrayList<Map<String,Integer>>(); Map<String,Integer> t1 = new HashMap<String,Integer>(); Map<String,Integer> t2 = new HashMap<String,Integer>(); Map<String,Integer> t3 = new HashMap<String,Integer>(); Map<String,Integer> t4 = new HashMap<String,Integer>(); t1.put("a", 1); t2.put("b", 2); t3.put("c", 3); t4.put("d", 1); list.add(t1); list.add(t2); list.add(t3); list.add(t4); Collections.sort(list, new MapCompare()); System.out.println(list); } private class MapCompare implements Comparator<Map<String,Integer>>{ public int compare(Map<String,Integer> o1, Map<String,Integer> o2) { int value1 = o1.entrySet().iterator().next().getValue(); int value2 = o2.entrySet().iterator().next().getValue(); return value1-value2; } } }
相关文章推荐
- DNS无发解析-ping request could not find host
- ping 域名显示 Ping request could not find host 但是nslookup能正常解析
- windows XP升级SP3导致的ping 域名显示 Ping request could not find host 但是nslookup能正常解析的解决办法
- ping 域名显示 Ping request could not find host 但是nslookup能正常解析
- ping 域名显示 Ping request could not find host,
- ping 域名显示 Ping request could not find host 但是nsloo
- Ping域名出现“Ping request could not find host”信息
- (ping request could not find host)
- 忆龙2009:使用ACS进行机器跨域认证出现错误:"NTLIB: Could not find machine host"
- 忆龙2009:使用ACS进行机器跨域认证出现错误:"NTLIB: Could not find machine host"
- 解决文件无法上传的问题,错误信息:System.IO.DirectoryNotFoundException: Could not find a part of the path.
- Android开发错误——Could not find class
- CDbConnection failed to open the DB connection: could not find driver错误的处理
- Could not find class 'com.pinggupad.Tansuo', referenced from method com.ping和java java.lang.NoClassD
- ASP.NET错误: Could not find permission set named 'ASP.Net'
- hadoop错误org.apache.hadoop.util.DiskChecker$DiskErrorException Could not find any valid local directory for
- android 使用Tabhost 发生could not create tab content because could not find view with id 错误
- Could not find settings-wamp 下Mysql Administrator 登陆错误提示
- could not find a getter for ... in class ... 异常的原因解析
- puppet 认证错误:Could not request certificate: unknown message digest algorithm