I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 80eb7635 authored by dev's avatar dev
Browse files

findbugs: Added companion equals() and hashCode() methods to existing compareTo()

parent e3103762
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ public class NewsEntry implements Comparable<NewsEntry> { ...@@ -17,6 +17,7 @@ public class NewsEntry implements Comparable<NewsEntry> {
public String authorName; // subnode of author public String authorName; // subnode of author
/** reverse, newest first */ /** reverse, newest first */
@Override
public int compareTo(NewsEntry e) { public int compareTo(NewsEntry e) {
if (updated > e.updated) if (updated > e.updated)
return -1; return -1;
...@@ -24,4 +25,22 @@ public class NewsEntry implements Comparable<NewsEntry> { ...@@ -24,4 +25,22 @@ public class NewsEntry implements Comparable<NewsEntry> {
return 1; return 1;
return 0; return 0;
} }
@Override
public boolean equals(Object o) {
if(o == null) {
return false;
}
if(!(o instanceof NewsEntry)) {
return false;
}
NewsEntry e = (NewsEntry) o;
return this.compareTo(e) == 0;
}
@Override
public int hashCode() {
return (int) updated;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment