Frameworks/base: Fix a hashCode implementation
Equals uses Arrays.equals. That means two responses are equal if the content of the data arrays is equal. By convention, the hash code of those objects should agree. In that case one cannot use hashCode on the array (which is the identity hash code). Change-Id: Icce8e2e71e9142421f5dac8a0ee8a211623fb704
This commit is contained in:
@@ -334,7 +334,7 @@ public class WifiP2pServiceResponse implements Parcelable {
|
||||
result = 31 * result + mTransId;
|
||||
result = 31 * result + (mDevice.deviceAddress == null ?
|
||||
0 : mDevice.deviceAddress.hashCode());
|
||||
result = 31 * result + (mData == null ? 0 : mData.hashCode());
|
||||
result = 31 * result + (mData == null ? 0 : Arrays.hashCode(mData));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user