boolean (@Nullable Element e1, @Nullable Element e2) { if (e1 == null && e2 == null) return true; if (e1 == null || e2 == null) return false; return Objects.equals(e1.getName(), e2.getName()) && isAttributesEqual(e1.getAttributes(), e2.getAttributes()) && contentListsEqual(e1.content().filter(CONTENT_FILTER), e2.content().filter(CONTENT_FILTER)); }