aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
index 25755a4..5cf1fa7 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
@@ -189,8 +189,11 @@ public class Pullrequest {
private String updatedOn;
private String createdOn;
+ @Override
public int compareTo(Comment target) {
- if (this.getId() > target.getId()) {
+ if (target == null){
+ return -1;
+ } else if (this.getId() > target.getId()) {
return 1;
} else if (this.getId().equals(target.getId())) {
return 0;
@@ -199,6 +202,21 @@ public class Pullrequest {
}
}
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ final Comment comment = (Comment) o;
+
+ return getId() != null ? getId().equals(comment.getId()) : comment.getId() == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return getId() != null ? getId().hashCode() : 0;
+ }
+
@JsonProperty("comment_id")
public Integer getId() {
return id;