How hould I use this SortedMap?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Nov 2009
Posts: 87
Reputation: P00dle is an unknown quantity at this point 
Solved Threads: 1
P00dle's Avatar
P00dle P00dle is offline Offline
Junior Poster in Training

How hould I use this SortedMap?

 
0
  #1
Nov 10th, 2009
Hi all, and thanks for your help, in advance.

I 'm stiing here with 2 choices, and I need help deciding which one to take. I want to take certain factors into account(i.e. efficiency, speed)

I have values that I want to place into a SortedMap. I can do this in one of two ways: Every record I want insert has an account number. These are not unique, as one account can have more than one item on its name, i.e. an account number can appear more than once.

I have a choice of two ways to put them into the SortedMap:
1) I can store all the products for an account in array, and use the account number as the key, and the array as the value in the map.

2) I can generate an unique id for every single record and use THAT as the key, and the record as the value. When I read everything from the map, I will then sort by value, not key.

Which choice is the better one? Is either more efficient/faster than the other?
I would like a steaming pile of coolbeans smothered in spicy awesomesauce please, with a side of scrambled win.
Reply With Quote Quick reply to this message  
Reply

Tags
collections, java, sortedmaps, sorting

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 426 | Replies: 0
Thread Tools Search this Thread



Tag cloud for collections, java, sortedmaps, sorting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC