📜  java 比较器比较 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:40.798000             🧑  作者: Mango

代码示例1
1. Collections.sort(people,Comparator.comparing(Person::getLastName));

2.        Collections.sort(list,
                Comparator.comparing( i -> -grow[i])
                          .thenComparing( i -> -plant[i]));

3.        Collections.sort(list,
                Comparator.comparing( (Integer i) -> -grow[i])
                          .thenComparing( i -> -plant[i]));

4.        Collections.sort(list,
                Comparator.comparing( i -> -grow[(int)i])
                          .thenComparing( i -> -plant[(int)i]));