0
我正在使用HashSet,它具有用於所有元素的一些屬性,然後將此Hashset添加到對應於每個元素的HashMap。另外,爲特定元素添加了很少的屬性(例如THEAD)。HashSet值計算錯誤
但是後面添加的屬性對齊對於表和THEAD都存在。下面的代碼有什麼問題嗎?
private static HashMap<String, Set<String>> ELEMENT_ATTRIBUTE_MAP =
new HashMap<String, Set<String>>();
HashSet<String> tableSet =
new HashSet<String>(Arrays.asList(new String[]
{HTMLAttributeName.style.toString(),
HTMLAttributeName.color.toString(),
HTMLAttributeName.dir.toString(),
HTMLAttributeName.bgColor.toString()}));
ELEMENT_ATTRIBUTE_MAP.put(HTMLElementName.TABLE, new HashSet<String>(tableSet));
// Add align only for Head
tableSet.add(HTMLAttributeName.align.toString());
ELEMENT_ATTRIBUTE_MAP.put(HTMLElementName.THEAD, tableSet);
是什麼問題? –
我不希望對齊屬性是HashSet對應表的一部分。 – Sriharsha