mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Use standard (not Identity) HashMaps for OptionKeys and NodeMetadataKeys
This commit is contained in:
parent
37367fe91f
commit
bd349ac4a3
@ -32,10 +32,12 @@ import java.util.Objects;
|
||||
final class SimpleOptionKey<T> implements OptionKey<T> {
|
||||
private final String name;
|
||||
private final Class<T> type;
|
||||
private final int hashCode;
|
||||
|
||||
SimpleOptionKey(String name, Class<T> type) {
|
||||
this.name = name.toLowerCase();
|
||||
this.type = type;
|
||||
this.hashCode = Objects.hash(this.name, this.type); // cache hashcode
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,6 +66,6 @@ final class SimpleOptionKey<T> implements OptionKey<T> {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.name, this.type);
|
||||
return this.hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -61,7 +62,7 @@ public abstract class AbstractNodeBuilder<N extends ScopedNode<N, B>, B extends
|
||||
this.value = value;
|
||||
this.expireAt = expireAt;
|
||||
this.context = new ImmutableContextSetImpl.BuilderImpl().addAll(context);
|
||||
this.metadata = new IdentityHashMap<>(metadata);
|
||||
this.metadata = new HashMap<>(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@ -124,9 +124,9 @@ public class QueryOptionsBuilderImpl implements QueryOptions.Builder {
|
||||
|
||||
if (this.options == null || this.copyOptions) {
|
||||
if (this.options != null) {
|
||||
this.options = new IdentityHashMap<>(this.options);
|
||||
this.options = new HashMap<>(this.options);
|
||||
} else {
|
||||
this.options = new IdentityHashMap<>();
|
||||
this.options = new HashMap<>();
|
||||
}
|
||||
this.copyOptions = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user