Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Read on ArrayList vs Vector in Collections

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my blog post on ArrayList vs Vector - http://myprogressivelearning.wordpress.com/2014/12/17/why-to-prefer-arraylist-over-vector-in-java-collections-differences/ . Please provide valuable comment on it. To increase the knowledge. [not to promote]
 
author & internet detective
Posts: 40359
820
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cover a lot of differences. I see a key thing missing. That Vector was created before ArrayList and at one point the default choice. For new code that needs a synchronized collection, the Java 7 Collections classes are often preferable.
 
Marshal
Posts: 26293
80
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's another thing you didn't mention -- Vector has some methods which ArrayList doesn't have. I'm not saying they are methods which can't be replaced, but a couple of years ago when I was refactoring some code which used Vector, I left it alone because it used them.

Apart from that, the article was a blast from the past. People used to really care back in 2004. For some reason I never understood, they resented the fact that Vector was obsolete and they would go to ridiculous lengths to "explain" why Vector should be used.
 
Master Rancher
Posts: 3756
49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:For new code that needs a synchronized collection, the Java 7 Collections classes are often preferable.


Non-crappy concurrent collections (e.g. ArrayBlockingQueue or ConcurrentHashMap) started becoming available in JDK 5, and each release since then has added more. Nowadays it's also worth considering GS Collections which offer additional functionality and performance enhancements.
 
santhoshkumar kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Boyarsky & @Simmons Thank you for lighting me on new collections. I will try to learn the latest collections which gives better performance and update the post. @Clapham Thank you. I believe for performance centric applications, we should avoid using the Vector.
 
reply
    Bookmark Topic Watch Topic
  • New Topic