-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDocument.java
More file actions
40 lines (32 loc) · 867 Bytes
/
Copy pathDocument.java
File metadata and controls
40 lines (32 loc) · 867 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
import java.io.Serializable;
public class Document implements Serializable{
private static final long serialVersionUID = 431266082485097493L;
private String title;
private String description;
public Document(String title, String description){
this.title = title;
this.description = description;
}
public String getTitle(){
return title;
}
public String getContent(){
return description;
}
@Override
public String toString(){
return "title: "+title+"\ndescription: "+description+"\n";
}
@Override
public boolean equals(Object o){
if ( this == o ) return true;
if ( !(o instanceof Document) ) return false;
Document item = (Document)o;
return item.getTitle().equals(title)&&
item.getContent().equals(description);
}
@Override
public int hashCode(){
return (title.hashCode()*7 + description.hashCode())*21;
}
}