Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
81 lines (61 loc) · 1.35 KB

File metadata and controls

81 lines (61 loc) · 1.35 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.comparable;
import java.util.Comparator;
public class Employee implements Comparable<Employee> {
private int id;
private String name;
private int age;
public Employee() {
}
public Employee(int id, String name, int age) {
this.id = id;
this.name = name;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Employee [id=" + id + ", name=" + name + ", age=" + age + "]";
}
@Override
public int compareTo(Employee o) {
return this.id - o.id;
}
public static Comparator<Employee> idComparator
= new Comparator<Employee>() {
@Override
public int compare(Employee o1, Employee o2) {
return o1.id - o2.id;
}
};
public static Comparator<Employee> nameComparator
= new Comparator<Employee>() {
@Override
public int compare(Employee o1, Employee o2) {
return o1.name.compareTo(o2.name);
}
};
public static Comparator<Employee> ageComparator
= new Comparator<Employee>() {
@Override
public int compare(Employee o1, Employee o2) {
return o1.age -o2.age;
}
};
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.