删除重复我试图从的ArrayList与流行的技术去除重复:从ArrayList的问题
yourList = new ArrayList<String>(new LinkedHashSet<String>(yourList));
它的工作原理,但由于该ArrayList是在HashMap中我得到了这个问题。
private void removeDuplicate(HashMap<String, ArrayList<LinkedList<String>>> p)
{
//cycle for each entry of HashMap
for(Map.Entry<String, ArrayList<LinkedList<String>>> entry : p.entrySet())
{
ArrayList<LinkedList<String>> partitions = entry.getValue();
partitions = new ArrayList<LinkedList<String>>(new LinkedHashSet<LinkedList<String>>(partitions));
}
}
问题是在那之后,HashMap和以前一样! 变量分区不再有重复,但整个HashMap不变。 问题在哪里?
你如何匹配'分区'与哈希图? – XtremeBaumer