!1212 自己实现的hashCode替换为标准hashCode

Merge pull request !1212 from handy/v6-dev
This commit is contained in:
Looly 2024-04-23 00:52:28 +00:00 committed by Gitee
commit 26782bce45
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 4 additions and 5 deletions

View File

@ -179,8 +179,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
@Override
public int hashCode() {
final long bits = Double.doubleToLongBits(value);
return (int) (bits ^ bits >>> 32);
return Double.hashCode(value);
}
// -----------------------------------------------------------------------

View File

@ -192,7 +192,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
@Override
public int hashCode() {
return (int) (value ^ (value >>> 32));
return Long.hashCode(value);
}
// -----------------------------------------------------------------------

View File

@ -380,7 +380,7 @@ public class Money implements Serializable, Comparable<Money> {
*/
@Override
public int hashCode() {
return (int) (cent ^ (cent >>> 32));
return Long.hashCode(cent);
}
/**

View File

@ -74,7 +74,7 @@ public class SingletonTest {
@Disabled
void issue3435Test() {
final String key = "123";
final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
for (int i = 0; i < 100; i++) {
threadPoolExecutor.execute(() -> {
Singleton.get(key, () -> {