public FieldValue setValue(FieldValue value) {
            if (value == null) {
                throw new NullPointerException("Null values in Struct not supported, use removeFieldValue() to remove value instead.");
            }

            int index = values.getIndexOfKey(id);
            FieldValue retVal = null;
            if (index == -1) {
                values.put(id, value);
                invalidateOrder();
            } else {
                retVal = values.value(index);
                values.setValue(index, value);
            }

            return retVal;
        }
Clears this and assigns from the given {@link StructuredFieldValue}
document/src/main/java/com/yahoo/document/datatypes/Struct.java