public Integer put(K key, Integer weight) {
        verifyElementCompatibility(key);
        IntegerFieldValue ifv =  putUnChecked(key, new IntegerFieldValue(weight));
        return ifv != null ? ifv.getInteger() : null;
    }
Add a key with an associated weight to this set. If the key is already present in this set, the previous
association is replaced. Checks to validate that all keys are of the same type.

@param key    the key to add
@param weight the weight to associate with this key
@return the weight that was previously associated with this key, or null (if there was no previous key)
document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java