• 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

Best Collection (Urgent)

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi


I need to maintain a big collection of data in memory. And I need to insert/remove objects from that. Currently I am using Vector for that. But I want to make my application faster. Can any body suggest me which is the best collection for that purpose.

Even if I will be able to save 1 millisecond then also it will be highly appreciated.

Thanks & Regards
Pax Smith
 
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If insertion / deletion are the main operations, then probably you should have a look at java.util.LinkedList. But the get() operation of a LinkedList is costly when compared to an ArrayList.

Ofcourse, Vector has an advantage - it is synchronized where as the ArrayList & LinkedList are not (that is the reason why Vector is slow). So, check whether you can afford to replace Vectors with LinkedList (or see whether using the synchronizedList method in Collections class will help, in that case).
[ February 01, 2006: Message edited by: Mani Ram ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic