Skip to content

Commit 8c5d17b

Browse files
committed
Switch List for HashSet for O(1) instead of O(n)
ty @7smile7 on Spigot
1 parent 192e3fb commit 8c5d17b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/main/java/com/samjakob/spigui/SGMenu.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
import org.bukkit.inventory.InventoryHolder;
1111
import org.bukkit.plugin.java.JavaPlugin;
1212

13-
import java.util.ArrayList;
14-
import java.util.HashMap;
15-
import java.util.List;
16-
import java.util.Map;
13+
import java.util.*;
1714
import java.util.function.Consumer;
1815

1916
/**
@@ -42,7 +39,7 @@ public class SGMenu implements InventoryHolder {
4239
private int rowsPerPage;
4340

4441
private final Map<Integer, SGButton> items;
45-
private final List<Integer> stickiedSlots;
42+
private final HashSet<Integer> stickiedSlots;
4643

4744
private int currentPage;
4845
private Boolean blockDefaultInteractions;
@@ -70,7 +67,7 @@ public class SGMenu implements InventoryHolder {
7067
this.tag = tag;
7168

7269
this.items = new HashMap<>();
73-
this.stickiedSlots = new ArrayList<>();
70+
this.stickiedSlots = new HashSet<>();
7471

7572
this.currentPage = 0;
7673
}

0 commit comments

Comments
 (0)