fossilesqueM to Science MemesEnglish · 7 months agoExplain yourselves, comp sci.imagemessage-square71fedilinkarrow-up1521arrow-down117
arrow-up1504arrow-down1imageExplain yourselves, comp sci.fossilesqueM to Science MemesEnglish · 7 months agomessage-square71fedilink
minus-squareunalivejoy@lemm.eelinkfedilinkEnglisharrow-up1·7 months agoThread safe as in it raises an exception instead of breaking your list.
minus-squareDaPorkchop_@lemmy.mllinkfedilinkEnglisharrow-up1·7 months agoOnly if one thread modifies it while another one is iterating over it, if two threads try to modify the list at once there isn’t any kind of synchronization and it really could break your list.
minus-squareunalivejoy@lemm.eelinkfedilinkEnglisharrow-up1·7 months agoFor everything else, there’s Collections.synchronizedList(new ArrayList<>())
Thread safe as in it raises an exception instead of breaking your list.
Only if one thread modifies it while another one is iterating over it, if two threads try to modify the list at once there isn’t any kind of synchronization and it really could break your list.
For everything else, there’s
Collections.synchronizedList(new ArrayList<>())