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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 47;
|
final int prime = 47;
|
||||||
long result = 0;
|
int result = 0;
|
||||||
for (ResourceInformation entry : resources) {
|
for (ResourceInformation entry : resources) {
|
||||||
result = prime * result + entry.hashCode();
|
result = prime * result + entry.hashCode();
|
||||||
}
|
}
|
||||||
return (int) result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,9 +155,6 @@ public int compareTo(Resource other) {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 47;
|
final int prime = 47;
|
||||||
long result = prime + getMemorySize();
|
return prime * (prime + Long.hashCode(getMemorySize())) + getVirtualCores();
|
||||||
result = prime * result + getVirtualCores();
|
|
||||||
|
|
||||||
return (int) result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user