據我所知,HashMap
不允許插入重複值,並用最新的條目替換上次重複的值。 有沒有辦法打印在put
方法中找到的重複項?HashMap重複值 - 確定重複項
我有下面的代碼片段:
for(int i = 0; i <= elements.length - 1; i++) {
nodeDBList = (NodeList) xPath.compile(elements[i]).evaluate(dbDocument, XPathConstants.NODESET);
for (int j = 0; j < nodeDBList.getLength(); j++) {
if(nodeDBList.item(j).getFirstChild() != null)
dbList.put(nodeDBList.item(j).getFirstChild().getNodeValue().toLowerCase().trim(),
nodeDBList.item(j).getNodeName().toLowerCase().trim());
}
}
的價值觀,你的意思是鑰匙? – codeMan 2014-11-25 13:43:26
重寫HashMap – 2014-11-25 13:45:56