如何在Java中的哈希表中添加列表 [英] How to add list in hash table in java

查看:167
本文介绍了如何在Java中的哈希表中添加列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Java中的哈希表中添加列表:)

[edit]删除了粗体的虚假粗体,将大写字母"do"替换为"to"-OriginalGriff [/edit]

How to add list in hash table in Java :)

[edit]Spurious bold removed, capitalization, "do" replaced with "to" - OriginalGriff[/edit]

推荐答案

此示例应为您提供帮助: http://www.javadeveloper.co.in/java-example/java-hashtable-example.html [ ^ ]

试试吧!
This sample should help you out: http://www.javadeveloper.co.in/java-example/java-hashtable-example.html[^]

Try!


Google是您的朋友:很好,经常拜访他.他的回答是告诉您您需要知道什么,而不会浪费您的时间或我们的时间,只需问一些他知道答案的问题即可.

一个快速的Google,使用从您的主题粘贴的在Java哈希表中添加列表",可以提供大量的响应,包括本教程 [ ^ ]
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[^]


你好,

非常简短:

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>




希望这会给您带来一个快速的想法...实际上,地图的类型不同,但是由于您要使用哈希-> HashMap是您需要的一个...

干杯,阿恩特




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


这篇关于如何在Java中的哈希表中添加列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆