Delegate to Objects.hashCode().

This commit is contained in:
Gary Gregory 2021-08-24 11:54:20 -04:00
parent d05073e66d
commit dcc6568100
1 changed files with 3 additions and 3 deletions

View File

@ -760,8 +760,8 @@ public class ObjectUtils {
*/ */
@Deprecated @Deprecated
public static int hashCode(final Object obj) { public static int hashCode(final Object obj) {
// hashCode(Object) retained for performance, as hash code is often critical // hashCode(Object) for performance vs. hashCodeMulti(Object[]), as hash code is often critical
return obj == null ? 0 : obj.hashCode(); return Objects.hashCode(obj);
} }
/** /**
@ -791,7 +791,7 @@ public class ObjectUtils {
int hash = 1; int hash = 1;
if (objects != null) { if (objects != null) {
for (final Object object : objects) { for (final Object object : objects) {
final int tmpHash = hashCode(object); final int tmpHash = Objects.hashCode(object);
hash = hash * 31 + tmpHash; hash = hash * 31 + tmpHash;
} }
} }