No. ArrayList is thread safe and implements the connections API. Vector doesn’t. Though if you’re using Java, there’s almost no instance where you would want to use a Vector instead of ArrayList.
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.
joyjoy@lemm.ee 7 months ago
No. ArrayList is thread safe and implements the connections API. Vector doesn’t. Though if you’re using Java, there’s almost no instance where you would want to use a Vector instead of ArrayList.
DaPorkchop_@lemmy.ml 7 months ago
ArrayList isn’t thread-safe, though…
joyjoy@lemm.ee 7 months ago
Thread safe as in it raises an exception instead of breaking your list.
DaPorkchop_@lemmy.ml 7 months ago
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.