• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference b/w Array, arraylist, vector

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between Array, ArrayList, Vector ?
Need this info imm.. pl someone give me a clear picture.
Thanks in advance
SJ
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
SJ Rao
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Dirk, I got a lot of info in the "search".
SJ
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should note that in general it is recommended that you never use Vector. Dirk explained the technique to use for a synchronized Collection.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic