问题描述
是否有可能映射关键多维数组列表。有些东西像下面的例子..
Is it possible to map key to Multi Dimensional Array List. Some thing like following example..
Map<K,V>
其中K是字母表中的列表键,V是存储单词列表的多维数组列表或正常数组列表。有些东西就像一个应用程序,它可以读取字典文件。我想看到一个例子。例如可以是任何地图和多维数组列表有关。 或有执行收取任何其他有效的方式?我从来没有使用过这样的实现,所以如果已经有相关的矿山QA线程请张贴的链接。
Where K is key for list of alphabet and V is a multi dimensional array list or normal array list that stores list of word. Some thing like a application that reads a dictionary file. I want to see an example. Example can be anything related to Map and Multi Dimensional Array-list. Or is there any other efficient way to implement collection? I have never used such implementations so if there is already a thread related to mine QA please post the link.
推荐答案
您可以使用<一个href=\"http://guava-libraries.google$c$c.com/svn/tags/release03/javadoc/com/google/common/collect/Multimap.html\"相对=nofollow>如果你想多个值与一个键关联番石榴的Multimap之的。您需要<一个href=\"http://guava-libraries.google$c$c.com/svn/tags/release03/javadoc/com/google/common/collect/ArrayListMultimap.html\"相对=nofollow> ArrayListMultimap 了解您的具体情况。
You can use Guava's Multimap's if you want to associate multiple values with a single key. You need ArrayListMultimap for your specific case.
示例
ListMultimap<String, String> dict= new ArrayListMultimap<String, String>();
dict.put("key 1", "value 1");
dict.put("key 1", "value 2");
dict.put("key 2", "value 1");
这篇关于JAVA多映射的ArrayList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!