@Override
    public FieldValue applyTo(FieldValue fval) {
        if (fval instanceof Array) {
            Array array = (Array) fval;
            FieldValue element = array.getFieldValue(((IntegerFieldValue) value).getInteger());
            element = update.applyTo(element);
            array.set(((IntegerFieldValue) value).getInteger(), element);
        } else if (fval instanceof WeightedSet) {
            WeightedSet wset = (WeightedSet) fval;
            WeightedSetDataType wtype = wset.getDataType();
            Integer weight = wset.get(value);
            if (weight == null) {
                if (wtype.createIfNonExistent() && update instanceof ArithmeticValueUpdate) {
                    weight = 0;
                } else {
                    return fval;
                }
            }
            weight = (Integer) update.applyTo(new IntegerFieldValue(weight)).getWrappedValue();
            wset.put(value, weight);
            if (wtype.removeIfZero() && update instanceof ArithmeticValueUpdate && weight == 0) {
                wset.remove(value);
            }
        }
        return fval;
    }
Sets the key of the nested update
document/src/main/java/com/yahoo/document/update/MapValueUpdate.java