wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes put values in the TreeMap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "put values in the TreeMap" Watch "put values in the TreeMap" New topic
Author

put values in the TreeMap

umut uzumcu
Ranch Hand

Joined: Jan 10, 2007
Posts: 43
How can I put

unique_number(key) , name(value), surname(value), addres(value)

those information into the TreeMap? TreeMap takes 1 key and 1 value at a time, what is the way to put more value in the map for a key?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

No, Maps only support one value for a key. However, you can encapsulate your data in an object and store that instead of the three values.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: put values in the TreeMap
 
Similar Threads
When we use treeMap and input duplicate Key... the overided value is displayed... why is it notin hm
TreeMap
Performing Math on Integer Class
Bubble Sort Set using Comparator
sorting the values using Hsh Map