[AWARE] Make PeerHandle comparable/hashable
Add public equals()/hash() methods to PeerHandle. Allows the handle to be used across multiple calls/sessions. (partial cherry-pick of commit3d33d7495f) (cherry-pick of commit0d49c0dda8) Bug: 68931709 Test: builds, unit test, integration test Change-Id: I87df50edb948a7afc90e496165013235ddca1e48 Merged-In: Idc59269d4275181ed6d9a793213c681dc4e98134 Merged-In: I6848acda9bfef306b8feaae6987ff18f7bc2e6ec
This commit is contained in:
@@ -32,4 +32,22 @@ public class PeerHandle {
|
||||
|
||||
/** @hide */
|
||||
public int peerId;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof PeerHandle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return peerId == ((PeerHandle) o).peerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return peerId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user