mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-21 06:41:43 +01:00
Use an identity map to store Snapshotable
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
1384bc0c18
commit
0dc7f52a50
@ -2,16 +2,13 @@
|
||||
|
||||
package net.minestom.server.snapshot;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
final class SnapshotUpdaterImpl implements SnapshotUpdater {
|
||||
private final Object2ObjectOpenHashMap<Snapshotable, AtomicReference<Snapshot>> referenceMap = new Object2ObjectOpenHashMap<>();
|
||||
private final Map<Snapshotable, AtomicReference<Snapshot>> referenceMap = new IdentityHashMap<>();
|
||||
private List<Entry> queue = new ArrayList<>();
|
||||
|
||||
static <T extends Snapshot> @NotNull T update(@NotNull Snapshotable snapshotable) {
|
||||
|
@ -5,6 +5,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents an object which is regularly saved into a snapshot.
|
||||
* <p>
|
||||
* Implementations must be identity-based.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public interface Snapshotable {
|
||||
|
Loading…
Reference in New Issue
Block a user