Commit 123fc263 authored by Yazawazi's avatar Yazawazi Committed by GitHub
Browse files

cache fetters

parent 376c668d
...@@ -57,6 +57,9 @@ public class GenshinData { ...@@ -57,6 +57,9 @@ public class GenshinData {
private static final Int2ObjectMap<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>(); private static final Int2ObjectMap<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>();
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
// Cache
private static Map<Integer, List<Integer>> fetters = new HashMap<>();
public static Int2ObjectMap<?> getMapByResourceDef(Class<?> resourceDefinition) { public static Int2ObjectMap<?> getMapByResourceDef(Class<?> resourceDefinition) {
Int2ObjectMap<?> map = null; Int2ObjectMap<?> map = null;
...@@ -226,14 +229,15 @@ public class GenshinData { ...@@ -226,14 +229,15 @@ public class GenshinData {
} }
public static Map<Integer, List<Integer>> getFetterDataEntries() { public static Map<Integer, List<Integer>> getFetterDataEntries() {
// Can I do this? if (fetters.isEmpty()) {
Map<Integer, List<Integer>> fetters = new HashMap<>(); fetterDataMap.forEach((k, v) -> {
fetterDataMap.forEach((k, v) -> { if (!fetters.containsKey(v.getAvatarId())) {
if (!fetters.containsKey(v.getAvatarId())) { fetters.put(v.getAvatarId(), new ArrayList<>());
fetters.put(v.getAvatarId(), new ArrayList<>()); }
} fetters.get(v.getAvatarId()).add(k);
fetters.get(v.getAvatarId()).add(k); });
}); }
return fetters; return fetters;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment