9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

优化key equals

This commit is contained in:
XiaoMoMi
2025-11-25 20:36:07 +08:00
parent 4c9058528f
commit 23e416ae6a
2 changed files with 4 additions and 6 deletions

View File

@@ -39,9 +39,7 @@ public record Key(String namespace, String value) {
@Override
public int hashCode() {
int result = this.namespace.hashCode();
result = 31 * result + this.value.hashCode();
return result;
return 31 * this.namespace.hashCode() + this.value.hashCode();
}
@Override
@@ -54,7 +52,7 @@ public record Key(String namespace, String value) {
}
if (!(obj instanceof Key key)) return false;
// 先比value命中率高
return this.value.equals(key.value()) && this.namespace.equals(key.namespace());
return this.value.equals(key.value) && this.namespace.equals(key.namespace);
}
@Override

View File

@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx1G
# Project settings
project_version=0.0.65.12.2
project_version=0.0.65.13
config_version=58
lang_version=40
project_group=net.momirealms
@@ -38,7 +38,7 @@ zstd_version=1.5.7-6
commons_io_version=2.21.0
commons_lang3_version=3.20.0
sparrow_nbt_version=0.10.6
sparrow_util_version=0.65
sparrow_util_version=0.66
fastutil_version=8.5.18
netty_version=4.1.128.Final
joml_version=1.10.8