@Override
    public boolean equals(Object o) {
        if (!(o instanceof DocumentType other)) return false;
        // Ignore whether one of them have added inheritance to super Document.0 type
        if (super.equals(o) && contentStructType.equals(other.contentStructType)) {
            if ((inherits.size() > 1 || other.inherits.size() > 1) ||
                (inherits.size() == 1 && other.inherits.size() == 1)) {
                return inherits.equals(other.inherits);
            }
            return !(((inherits.size() == 1) && !inherits.get(0).getDataTypeName().equals(new DataTypeName("document")))
                     || ((other.inherits.size() == 1) && !other.inherits.get(0).getDataTypeName().equals(new DataTypeName("document"))));
        }
        return false;
    }
Returns an iterator over all fields in this documenttype

@return An iterator for iterating the fields in this documenttype.
document/src/main/java/com/yahoo/document/DocumentType.java