Skip to content

Commit b549b40

Browse files
committed
fix indent
1 parent 8786296 commit b549b40

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Algorithms/ComparableExample.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11

22
class Person implements Comparable<Person>{
3-
int start,end,c;
4-
public Person(int start,int end,int c){
5-
this.start=start;
6-
this.end=end;
7-
this.c=c;
8-
}
3+
private int start, end, salary;
94

10-
public int compareTo(Person p){
11-
return this.start - p.start;
5+
public Person(int start, int end, int salary){
6+
this.start = start;
7+
this.end = end;
8+
this.salary = salary;
9+
}
10+
11+
@Override
12+
public int compareTo(Person that){
13+
return this.start - that.start;
1214
}
1315
}

Algorithms/ComparatorSnippet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public int getAge(){
1515

1616
public class ComparatorSnippet{
1717

18-
public static void main(String... s){
18+
public static void main(String... args)throws Exception{
1919

20-
Developer[] devs = Collections.sort(listDevs, new Comparator<Developer>() {
20+
Developer[] devs = Collections.sort(listDevs, new Comparator<Developer>() {
2121
@Override
2222
public int compare(Developer o1, Developer o2) {
2323
return o1.getAge() - o2.getAge();

0 commit comments

Comments
 (0)