YARN-7336. Unsafe cast from long to int Resource.hashCode() method
(Contributed by Miklos Szegedi via Daniel Templeton)
This commit is contained in:
parent
9a7e810838
commit
d64736d589
@ -463,11 +463,11 @@ public String toString() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 47;
|
||||
long result = 0;
|
||||
int result = 0;
|
||||
for (ResourceInformation entry : resources) {
|
||||
result = prime * result + entry.hashCode();
|
||||
}
|
||||
return (int) result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,9 +155,6 @@ public int compareTo(Resource other) {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 47;
|
||||
long result = prime + getMemorySize();
|
||||
result = prime * result + getVirtualCores();
|
||||
|
||||
return (int) result;
|
||||
return prime * (prime + Long.hashCode(getMemorySize())) + getVirtualCores();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user