• Post Reply Bookmark Topic Watch Topic
  • New Topic

cld some one give me real world examples..  RSS feed

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • 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
  • 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
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!