my dog learned polymorphism*
The moose likes JDBC and the fly likes Vectors vs Array Lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Vectors vs Array Lists" Watch "Vectors vs Array Lists" New topic
Author

Vectors vs Array Lists

Rick Harrison
Greenhorn

Joined: Oct 16, 2000
Posts: 4
Good evening to all -
Which is better to use when retrieving rows from a database for
processing (max 100 rows): Vectors or Array Lists?
Thank you
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
The main difference is that all access to a Vector is synchronized, which is slower, but safer in a multi-threaded environment. If you are not using threads, or have protected your access in another way, ArrayList is a better choice.
The only other thing to be careful of is Vector is part of Java 1.0 and 1.1, but ArrayList was only added in Java 1.2 and 1.3, so if you write code using ArrayList (or any of the collections API) you need at least a Java 1.2 VM.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vectors vs Array Lists
 
Similar Threads
creating names for vectors
Locking the record using the cookie
cloning array of vectors
dynamic swing tables ??????????
creating variables in a loop