Skip to content

Commit

Permalink
Merge pull request #502 from CodeAndChoke/hashcode_equals
Browse files Browse the repository at this point in the history
Added equals and hashcode
  • Loading branch information
bitwiseman committed Sep 10, 2019
2 parents 504286e + 13b6a17 commit 44a70b3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/org/kohsuke/github/GHLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

/**
* @author Kohsuke Kawaguchi
Expand Down Expand Up @@ -53,4 +54,20 @@ public void setColor(String newColor) throws IOException {
}
return r;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final GHLabel ghLabel = (GHLabel) o;
return Objects.equals(url, ghLabel.url) &&
Objects.equals(name, ghLabel.name) &&
Objects.equals(color, ghLabel.color) &&
Objects.equals(repo, ghLabel.repo);
}

@Override
public int hashCode() {
return Objects.hash(url, name, color, repo);
}
}

0 comments on commit 44a70b3

Please sign in to comment.