Perhaps if you could give a little background as to why you want to store objects of these different types in the same collection then someone could propose a solution. I'm not sure that what you're asking about is the best option for you.
I don't think you can add multiple values for a single key in a TreeMap. But i think you can add the values in LinkedList or a Vector and then you can map it with the key in a TreeMap.
Hope it helps you
posted 15 years ago
Thanks for the replies people The reason I have to do it this way is because its an assignment. I have to use Treemap to hold the data that is contained in upto two accounts and the customer details.
Now the customer has a customer ID and the accounts have different numbers too. My first thought was to have a Treemap to hold the customer details, inside the customer details would be two variables that hold the unique account IDs. I would then use a second TreeMap to hold all the account details using their uniqueIDs as the TreeMap key.
One complication, (well its complicated to me) the accounts have a different number of parameters. [ September 06, 2004: Message edited by: Steve Durber ]
I'm full of tinier men! And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop