• 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

cld some one give me real world examples..

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am not sure if this is the right forum to post this question.
I know Vector is ThreadSafe but List is not. Can someone give me a realworld example on this ? I mean when to go for Vector and when to go for using List.
It wll be really helpful if someone could give me some examples on the usage of ArrayList, Map, HashSet, HashTable etc.
Thanks in advance
Raj...
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can get example on all in any book (check out complete reference).
Vector is not completely thread safe (if remember correctly). But you can make it (and all classes) as thread safe including (List interface and Vector class). And choice b/w List and Vector also depends upon requirement. There is one more imp. difference that is List stores elements in sequential order.
regrads,
Sanjeev.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sanjeev:

(javadoc Unlike the new collection implementations, Vector is synchronized.


That's the most importing difference to Lists.
But List is an interface, so you better compare a Vector to a LinkedList.
Lists and vector both are sequences.
But RTFM is a good idea though.
 
reply
    Bookmark Topic Watch Topic
  • New Topic