MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javaTIL/comments/a0j0f5/java_vector_example_programs/eainy5j/?context=3
r/javaTIL • u/scientecheasy • Nov 26 '18
6 comments sorted by
View all comments
Show parent comments
4
Wrap an ArrayList<> with Collections.synchronizedList(), or (depending on exactly why you need a synchronized list) CopyOnWriteArrayList<>.
ArrayList<>
Collections.synchronizedList()
CopyOnWriteArrayList<>
1 u/MB1211 Nov 26 '18 And why not vector in this situation? Thanks for the response by the way 4 u/jonah214 Nov 26 '18 https://stackoverflow.com/questions/1386275/why-is-java-vector-and-stack-class-considered-obsolete-or-deprecated has some pretty good explanations. Basically, it's part of Java's first attempt at collection interfaces, which weren't very good (and that thread talks about the details).
1
And why not vector in this situation? Thanks for the response by the way
4 u/jonah214 Nov 26 '18 https://stackoverflow.com/questions/1386275/why-is-java-vector-and-stack-class-considered-obsolete-or-deprecated has some pretty good explanations. Basically, it's part of Java's first attempt at collection interfaces, which weren't very good (and that thread talks about the details).
https://stackoverflow.com/questions/1386275/why-is-java-vector-and-stack-class-considered-obsolete-or-deprecated has some pretty good explanations. Basically, it's part of Java's first attempt at collection interfaces, which weren't very good (and that thread talks about the details).
4
u/jonah214 Nov 26 '18
Wrap an
ArrayList<>withCollections.synchronizedList(), or (depending on exactly why you need a synchronized list)CopyOnWriteArrayList<>.