Skip to content

Commit 4bed5e7

Browse files
committed
refactor problem 347: add type for comparable
1 parent 89f60b3 commit 4bed5e7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

TopKFrequentElements347/Solution.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
public class Solution {
2-
class Pair implements Comparable {
2+
class Pair implements Comparable<Pair> {
33
public int key;
44
public int value;
55
public Pair(int k, int v) {
66
key = k;
77
value = v;
88
}
99

10-
public int compareTo(Object that) {
11-
Pair other = (Pair)that;
12-
10+
public int compareTo(Pair other) {
1311
if (value < other.value)
1412
return 1;
1513

0 commit comments

Comments
 (0)