PRODRAMMER

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
import java.util.*;
class Picture implements Comparable<Picture>{
    public String name;    //파일이름
    public String ext;        //확장자
    public String city;    //도시이름
    public String date;    //시간
 
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getExt() {
        return ext;
    }
    public void setExt(String ext) {
        this.ext = ext;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
 
    
    @Override
    public int compareTo(Picture o) {
        // TODO Auto-generated method stub
        if(this.date.compareTo(o.date) > 0) {
            return 1;
        }
        else if(this.date.compareTo(o.date) < 0) {
            return -1;
        }
        else
            return 0;
    }
    
}
 
cs




자세한 정렬은 http://forum.falinux.com/zbxe/index.php?document_srl=572949&mid=lecture_tip 참조