Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to add list in hash table in Java :)

[edit]Spurious bold removed, capitalization, "do" replaced with "to" - OriginalGriff[/edit]
Posted
Updated 2-Mar-11 22:32pm
v2

 
Share this answer
 
Google is your friend: Be nice and visit him often. He responds by telling you what you need to know, without wasting your time or ours by asking questions that he knows the answers to!

A quick Google, using "add list in hash table in Java" pasted from your subject gives loads of responses, including this tutorial[^]
 
Share this answer
 
Hi,

very short and simple:

// create a hash table
Map<keytype,>> myMapOfLists = new HashMap<keytype,>>();

// i.e. you and the Key to be a String and the Lists containing objects of type Person
Map<string,>> familyMap = new HashMap<string,>>();

// now get a list:
List<person> personList = familyMap.get("The Robinsons");

</person>



Hope this will give you a quick Idea... Actually, there are different types of Maps but since you want a Hash -> HashMap is the one you need...

Cheers, Arndt
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900