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