ElementImpl extends NodeImpl implements Element { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + attributes.hashCode(); result = prime * result + name.hashCode(); result = prime * result + namespaceUri.hashCode(); return result; } protected  ElementImpl(String namespaceUri, String prefix, String name); protected  ElementImpl(String namespaceUri, String name,
			org.w3c.dom.Element xmlElement); String getNamespaceUri(); String getPrefix(); String getName(); Map<String, String> getNamespacePrefixMapping(); void setNamespacePrefixMapping(Map<String, String> namespace2Prefix); Collection<? extends Attribute> getAttributes(); abstract List<? extends Node> getChildren(); org.w3c.dom.Element asXmlNode(Document document); Object clone(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testHashCode() { ConcreteElementImpl elem1 = new ConcreteElementImpl("ns", "pre", "name"); ConcreteElementImpl elem2 = new ConcreteElementImpl("ns", "pre2", "name"); elem1.setAttribute(new ConcreteAttributeImpl("ns2", "pre3", "name", "value")); elem2.setAttribute(new ConcreteAttributeImpl("ns2", "pre3", "name", "value")); HashMap<String, String> mappings = new HashMap<String, String>(); mappings.put("ns4", "pre3"); elem1.setNamespacePrefixMapping(mappings); assertEquals(new Integer(elem1.hashCode()), new Integer(elem2 .hashCode())); }