forked from CentMeng/JavaFrameTest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.java
More file actions
46 lines (35 loc) · 869 Bytes
/
Copy pathTask.java
File metadata and controls
46 lines (35 loc) · 869 Bytes
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
package com.msj.sync.queue;
/**
* @author Vincent.M mengshaojie@188.com
* @date 2017/3/14 下午7:35
* @copyright ©2017 孟少杰 All Rights Reserved
* @desc 实现Comparable的Task,用于UsePriorityBlockingQueue
*/
public class Task implements Comparable<Task>{
private int id;
private String name;
private String age;
@Override
public int compareTo(Task task) {
//-1 0 1这样顺序排序
return this.id>task.id? 1 : (this.id<task.id ? -1 :0);
}
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 String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
}