• 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

ArrayList vs. Vector

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to come up with a good explination for my choices.txt and would appreciate some comments.
In my DBAdapter class, I have a method which returns a list of contractors but am not sure if I should return the list as an ArrayList or Vector. Which will be the best to use...? and why?
Both have dynamic sizing capabilities, but Vectors are synchronized...
Thank you in advance...
 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Wickes:
Sun documentation refers to ArrayList, HashMap, and HashSet as being the preferred "primary implementations". Their overall performance is better, and you should use them unless you need a special feature provided by another implementation. In general, Vector is slower because all of its methods are sync. Regular array are lighter wieght than any other collection class. If you find arrays fit your needs, you should consider them first, otherwise you should looke for the appropriate collection calss.
[ May 10, 2004: Message edited by: Hanna Habashy ]
 
Wickes Potgieter
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your response!!
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic