944,161 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 1393
  • Java RSS
Nov 10th, 2009
0

How hould I use this SortedMap?

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
P00dle is offline Offline
154 posts
since Nov 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: CHess chesk & Checkmate condition
Next Thread in Java Forum Timeline: SortedMap: a newbie question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC