aspose file tools*
The moose likes Beginning Java and the fly likes Difference b/w Array, arraylist, vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference b/w Array, arraylist, vector" Watch "Difference b/w Array, arraylist, vector" New topic
Author

Difference b/w Array, arraylist, vector

SJ Rao
Greenhorn

Joined: Mar 05, 2003
Posts: 25
What is the difference between Array, ArrayList, Vector ?
Need this info imm.. pl someone give me a clear picture.
Thanks in advance
SJ
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
In a quick nutshell...
I'd guess you did not mean java.sql.Array or java.lang.reflect.Array when you mentioned "Array". I'll assume you meant to refer to the typical array data structure in Java.
Try a quick search on this forum for "Vector ArrayList". You'll turn up quite a few explanations from past conversations. Note that the search page link is at the top right of this page.
Otherwise, you might want to spend a few moments reading the API documentation, the Arrays lesson of Sun's Java Tutorial, and the Collections Trail of Sun's Java Tutorial.
Good Luck
[ October 29, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
SJ Rao
Greenhorn

Joined: Mar 05, 2003
Posts: 25
Thanks a lot Dirk, I got a lot of info in the "search".
SJ
praveenkumar singamsetty
Greenhorn

Joined: Oct 29, 2003
Posts: 6
arrays hold homogeneous objects
vectors hold heterogeneous objects
arraylist is like vector....in the sense it can hold heterogeneous object
but the api is good than that of vector....
vectors r by default threadsafe for arraylist u hav 2 implement them
ciao
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
vectors r by default threadsafe for arraylist u hav 2 implement them
The Collections class provides an easy way to create a thread-safe List. This mechanism is referred to as a synchronization wrapper. To create a thread-safe List from an ArrayList, something similar to List mySynchronizedList = Collections.synchronizedList(myArrayList); should get the job done. (Note that both Vectors and Arraylists are Lists as each class implements the List interface.)
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You should note that in general it is recommended that you never use Vector. Dirk explained the technique to use for a synchronized Collection.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference b/w Array, arraylist, vector
 
Similar Threads
difference between ArrayList - Vector
What is difference between ArrayList and vector?
Difference between ArrayList and Vector
Difference between ArrayList and Vector
Question in Collection?