Map总结:
- Map 中获取一个不存在的key时返回null
List排序:
java.util.Collections.sort() 可以重写排序的方法 Collections.sort(list, new Comparator<T>() { });
更明白的理解就是: return this.age > o.age ? -1 : 1; 降序排列 等价于 return o.age - this.age return this.age > o.age ? 1 : -1; 升序排列 等价于 return this.age - o.age |
|
|