int (@Nullable Element e) { if (e == null) { return 0; } int result = e.getName().hashCode() * 31; result += computeAttributesHashCode(e); List<Content> content = e.getContent(); result = result * 31 + content.size(); for (Content child : content) { if (child instanceof Text) { result = result * 31 + computeTextHashCode((Text)child); } else if (child instanceof Element) { result = result * 31 + hashCode((Element)child); break; } } return result; }