P00dle 0 Junior Poster

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.