|
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
|
class UN implements Comparable{ private final int count; public UN() { this.count=0; } public UN(int count) { this.count=count; } public int getCount() { return this.count; } public String toString() { return "R[count:"+count+"]"; } public boolean equals(Object obj) { if(this==obj) { return true; } if(obj!=null&&obj.getClass()==UN.class) { UN r=(UN)obj; if(r.count==this.count) { return true; } } return false; } public int compareTo(Object obj) { UN r=(UN)obj; return count>r.count? 1:count<r.count? -1:0; }} |
HashSet和TreeSet中最好只放入不可变对象
最新推荐文章于 2022-10-28 14:15:53 发布
374

被折叠的 条评论
为什么被折叠?



