-
September 6th, 2010, 06:23 AM
#1
choose the right collection
Hello,
I have:
Code:
Map<Var, Integer = new LinkedHashMap<Var, Integer>();
//with Var my own object
I need a collection that:
- no permits duplicates; that is fine
- keep the order of insertion //fine too
- I can retrive an element by its position //no fine!
- I can retrive the value by the key //fine
WHich is the best? I thought arrayList and every time check if the new element I want insert within, is not within yet. The problem is that I must to many extraction by position, for this reason I thought it wasn't the best. actually I thinking to store them by Integer key instead of Var since even the Intger give me the position. The problem is that in other part of the program I'm accessign to it by the Var key
suggestions? thanks
Last edited by mickey0; September 6th, 2010 at 06:26 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|