Skip to content

Commit

Permalink
Make use of CopyOnWriteArray instead
Browse files Browse the repository at this point in the history
This is automatically safe for iterations (which Collections.synchronizedList is not)
	and it makes more sense for our use case given the rarity of our writes
  • Loading branch information
pajlada committed Nov 24, 2024
1 parent 3646c00 commit 168d9f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/questhelper/panel/QuestOverviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.awt.event.ItemEvent;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -95,7 +96,7 @@ public class QuestOverviewPanel extends JPanel

private final JButton collapseBtn = new JButton();

private final List<QuestStepPanel> questStepPanelList = Collections.synchronizedList(new ArrayList<>());
private final List<QuestStepPanel> questStepPanelList = new CopyOnWriteArrayList<>();

public QuestOverviewPanel(QuestHelperPlugin questHelperPlugin, QuestManager questManager)
{
Expand Down

0 comments on commit 168d9f9

Please sign in to comment.