Skip to content

Commit

Permalink
Added hashCode and equals()-methods to connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
crykn committed Sep 12, 2018
1 parent 70ede40 commit 6f4f6f2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/com/esotericsoftware/kryonet/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,23 @@ public Object getArbitraryData() {
public void setArbitraryData(Object arbitraryData) {
this.arbitraryData = arbitraryData;
}

@Override
public int hashCode() {
return 31 + id;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Connection other = (Connection) obj;
if (id != other.id)
return false;
return true;
}
}

0 comments on commit 6f4f6f2

Please sign in to comment.