We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88b59fe commit b0cf159Copy full SHA for b0cf159
Algorithms/ComparatorSnippet.java
@@ -0,0 +1,27 @@
1
+class Developer{
2
+ private int age;
3
+
4
+ public Developer(int age){
5
+ this.age = age;
6
+ }
7
8
+ void setAge(int age){
9
10
11
+ public int getAge(){
12
+ return age;
13
14
+}
15
16
+public class ComparatorSnippet{
17
18
+ public static void main(String... s){
19
20
+ Developer[] devs = Collections.sort(listDevs, new Comparator<Developer>() {
21
+ @Override
22
+ public int compare(Developer o1, Developer o2) {
23
+ return o1.getAge() - o2.getAge();
24
25
+ });
26
27
0 commit comments