dcsimg
Best way to implement a collection
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   HELIGON_Sandra
Posted On:   Thursday, January 30, 2003 06:18 AM

Which is the best way (cleanest) of creating/managing a collection of objects (a list of long or a list of JavaBeans ...) with Java ?
Is it Vector, Hashtable, Liste, Map ????

Re: Best way to implement a collection

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, January 30, 2003 08:10 AM

I have mostly been using Maps (references to the interface, actual objects created as HashMaps), because I usually want to add or get the items by a key.

Re: Best way to implement a collection

Posted By:   AlessandroA_Garbagnati  
Posted On:   Thursday, January 30, 2003 06:40 AM

Hi,

I think that is almost impossible to answer to this question. There are too many variables that should be considered before choosing the "best" collection.


You should first consider what kind of problem you are facing and what solution you have in mind. Then consider what are the needs: am I looking for a mapping solution or not... do I need synchronization or not... do I require ordering or not... I prefer faster insert/remove or searching/retrieving operations...


If you check the Collection FAQ area, you will be able to search and find some interesting FAQ where different collection types are compared. For example What are the differences between Vector and ArrayList? Which is best to use?, or What are the differences between ArrayList and LinkedList? and so on...

About | Sitemap | Contact