My Swing GUI displays a JList of items that are being sequentially removed by a background thread.
Behind the JList is an ArrayDeque<Card>, myHopper, implementing myHopper.getSize() and myHopper.getElementAt(), as per the contract of an AbstractListModel.
The background thread removes items using myHopper.poll().
Not surprisingly, I'm getting AWT array index out of bounds exceptions currently.
What should I be doing to properly synchronize access to myList between the EDT thread and my background thread? I have seen references to Collections.synchronizedList(arrayList) but I don't think that fits my ArrayDeque.