no Lists.newVector()

15 views
Skip to first unread message

enefem

unread,
Nov 15, 2009, 5:09:03 AM11/15/09
to Google Collections Library - users list
Is there any particular reason why there is no Lists.newVector() ?

Thanks

Kevin Bourrillion

unread,
Nov 15, 2009, 11:17:04 AM11/15/09
to enefem, Google Collections Library - users list
There has never really been a good reason to use Vector since JDK 1.2 when ArrayList was added.


On Sun, Nov 15, 2009 at 2:09 AM, enefem <nanda.f...@gmail.com> wrote:
Is there any particular reason why there is no Lists.newVector() ?

Thanks

--
Google Collections Library - users list
http://groups.google.com/group/google-collections-dev?hl=en

To unsubscribe, send email to:
google-collections...@googlegroups.com



--
Kevin Bourrillion @ Google
internal:  http://go/javalibraries
external: guava-libraries.googlecode.com

Andreas Petersson

unread,
Nov 15, 2009, 2:47:54 PM11/15/09
to Google Collections Library - users list
i cannot speak for the api designers, but vector is officially a
"legacy" class. (there is an official post by sun on this matter, on
http://java.sun.com/docs/books/tutorial/collections/implementations/index.html
)
it is superseded by ArrayList (not threadsave) or alternatively
Collections.synchronizedList().

in general, you want to synchronize over a sequence of operations on
the collections which is not cleanly possible with Vector. in this
situation, you can use Collections.synchronizedList() and build your
own synchronized blocks with it.
see also http://stackoverflow.com/questions/1386275/why-java-vector-class-is-considered-obsolete-or-deprecated

Nanda Firdausi

unread,
Nov 16, 2009, 4:00:02 AM11/16/09
to Google Collections Library - users list
Thank you for the answer...
--
Nanda Firdausi Muhammad
http://satukubik.com
Reply all
Reply to author
Forward
0 new messages