Simplify null checks in Pair.hashCode() using Objects.hashCode(). (#517)

This commit is contained in:
Isira Seneviratne 2020-04-20 14:10:39 +00:00 committed by GitHub
parent 7f45b8898b
commit d7f8dcedfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -207,8 +207,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
@Override
public int hashCode() {
// see Map.Entry API specification
return (getKey() == null ? 0 : getKey().hashCode()) ^
(getValue() == null ? 0 : getValue().hashCode());
return Objects.hashCode(getKey()) ^ Objects.hashCode(getValue());
}
/**