File tree 1 file changed +5
-7
lines changed
src/java.base/share/classes/java/util
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -4333,8 +4333,7 @@ public static int hashCode(long[] a) {
4333
4333
}
4334
4334
int result = 1 ;
4335
4335
for (long element : a ) {
4336
- int elementHash = (int )(element ^ (element >>> 32 ));
4337
- result = 31 * result + elementHash ;
4336
+ result = 31 * result + Long .hashCode (element );
4338
4337
}
4339
4338
return result ;
4340
4339
}
@@ -4469,7 +4468,7 @@ public static int hashCode(boolean[] a) {
4469
4468
4470
4469
int result = 1 ;
4471
4470
for (boolean element : a )
4472
- result = 31 * result + (element ? 1231 : 1237 );
4471
+ result = 31 * result + Boolean . hashCode (element );
4473
4472
4474
4473
return result ;
4475
4474
}
@@ -4496,7 +4495,7 @@ public static int hashCode(float[] a) {
4496
4495
4497
4496
int result = 1 ;
4498
4497
for (float element : a )
4499
- result = 31 * result + Float .floatToIntBits (element );
4498
+ result = 31 * result + Float .hashCode (element );
4500
4499
4501
4500
return result ;
4502
4501
}
@@ -4523,8 +4522,7 @@ public static int hashCode(double[] a) {
4523
4522
4524
4523
int result = 1 ;
4525
4524
for (double element : a ) {
4526
- long bits = Double .doubleToLongBits (element );
4527
- result = 31 * result + (int )(bits ^ (bits >>> 32 ));
4525
+ result = 31 * result + Double .hashCode (element );
4528
4526
}
4529
4527
return result ;
4530
4528
}
@@ -4557,7 +4555,7 @@ public static int hashCode(Object[] a) {
4557
4555
int result = 1 ;
4558
4556
4559
4557
for (Object element : a )
4560
- result = 31 * result + ( element == null ? 0 : element .hashCode () );
4558
+ result = 31 * result + Objects .hashCode (element );
4561
4559
4562
4560
return result ;
4563
4561
}
You can’t perform that action at this time.
0 commit comments