@Override
    public int compareTo(FieldValue obj) {
        int cmp = super.compareTo(obj);
        if (cmp != 0) {
            return cmp;
        }
        Struct rhs = (Struct)obj;
        cmp = values.size() - rhs.values.size();
        if (cmp != 0) {
            return cmp;
        }
        StructDataType type = getDataType();
        for (Field field : type.getFields()) {
            FieldValue lhsField = getFieldValue(field);
            FieldValue rhsField = rhs.getFieldValue(field);
            if (lhsField != null && rhsField != null) {
                cmp = lhsField.compareTo(rhsField);
                if (cmp != 0) {
                    return cmp;
                }
            } else if (lhsField != null || rhsField != null) {
                return (lhsField != null ? -1 : 1);
            }
        }
        return 0;
    }
Clears this and assigns from the given {@link StructuredFieldValue}
document/src/main/java/com/yahoo/document/datatypes/Struct.java