Skip to content

Commit 9cab48c

Browse files
committed
replace set with list in base input cache (recipes should not be dupes anyway)
1 parent 572d8c5 commit 9cab48c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/mekanism/common/recipe/lookup/cache/type/BaseInputCache.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package mekanism.common.recipe.lookup.cache.type;
22

3+
import java.util.ArrayList;
34
import java.util.Collections;
45
import java.util.HashMap;
5-
import java.util.HashSet;
6+
import java.util.List;
67
import java.util.Map;
7-
import java.util.Set;
88
import java.util.function.Predicate;
99
import mekanism.api.recipes.MekanismRecipe;
1010
import mekanism.api.recipes.ingredients.InputIngredient;
@@ -21,7 +21,7 @@ public abstract class BaseInputCache<KEY, INPUT, INGREDIENT extends InputIngredi
2121
* Map of keys representing inputs to a set of the recipes that contain said input. This allows for quick contains checking by checking if a key exists, as well as
2222
* quicker recipe lookup.
2323
*/
24-
private final Map<KEY, Set<RECIPE>> inputCache = new HashMap<>();
24+
private final Map<KEY, List<RECIPE>> inputCache = new HashMap<>();
2525

2626
@Override
2727
public void clear() {
@@ -56,7 +56,7 @@ public RECIPE findFirstRecipe(INPUT input, Predicate<RECIPE> matchCriteria) {
5656

5757
@Override
5858
public Iterable<RECIPE> getRecipes(INPUT input) {
59-
return inputCache.getOrDefault(createKey(input), Collections.emptySet());
59+
return inputCache.getOrDefault(createKey(input), Collections.emptyList());
6060
}
6161

6262
/**
@@ -75,7 +75,7 @@ public Iterable<RECIPE> getRecipes(INPUT input) {
7575
* @param recipe Recipe to add.
7676
*/
7777
protected void addInputCache(KEY input, RECIPE recipe) {
78-
inputCache.computeIfAbsent(input, i -> new HashSet<>()).add(recipe);
78+
inputCache.computeIfAbsent(input, i -> new ArrayList<>()).add(recipe);
7979
}
8080

8181
/**

0 commit comments

Comments
 (0)