Value is overridden if the key was already stored.
@throws IllegalArgumentException if key is null
@throws IllegalArgumentException if value is null
@since 6.1
772480
public ContextPropertiesCache put(String key, String value) {
    checkArgument(key != null, "Key of context property must not be null");
    checkArgument(value != null, "Value of context property must not be null");
    props.put(key, value);
    return this;
  }
121800
public void add(String key, String value)
    {
        if(key == null)
            throw new IllegalArgumentException("Null keys not allowed.");

        if(value == null)
            throw new IllegalArgumentException("Null values not allowed.");

        List<String> vals = map.get(key);
        if(vals == null)
        {
            vals = new ArrayList<String>();
            map.put(key,vals);
        }

        vals.add(value);
    }
584929
public synchronized void setProperty(PropertyKey key, Object value)
    {
        if (!isValidKey(key))
            throw new IllegalArgumentException("Key " + key + " is not valid for " + getMapClass());

        //
        // Validate the value argument, based upon the property type reference by the key
        //
        Class propType = key.getPropertyType();
        if (value == null)
        {
            if (propType.isPrimitive() || propType.isAnnotation())
                throw new IllegalArgumentException("Invalid null value for key " + key);
        }
        else
        {
            if (propType.isPrimitive())
                propType = (Class)_primToObject.get(propType);

            if (!propType.isAssignableFrom(value.getClass()))
            {
                throw new IllegalArgumentException("Value class (" + value.getClass() + 
                                                   ") not of expected type: " + propType);
            }
        }
        _properties.put(key, value);
        _propertySets.add(key.getPropertySet());
    }
319023
@Override
    public Long put(char key, Long value) {
        verifyStandardSetting(key, value);
        return super.put(key, value);
    }
452433
public V put(final Object key, final Object value)
    {
        final Object val = mapNullValue(value);
        requireNonNull(val, "value cannot be null");

        final Object[] entries = this.entries;
        final int mask = entries.length - 1;
        int index = Hashing.evenHash(key.hashCode(), mask);
        Object oldValue = null;

        while (entries[index + 1] != null)
        {
            if (entries[index] == key || entries[index].equals(key))
            {
                oldValue = entries[index + 1];
                break;
            }

            index = next(index, mask);
        }

        if (oldValue == null)
        {
            ++size;
            entries[index] = key;
        }

        entries[index + 1] = val;

        increaseCapacity();

        return unmapNullValue(oldValue);
    }
970623
public void put( String key, String value )
            throws IllegalArgumentException
    {
        if ( !key.matches( "[a-z-]*" ) ) {
            throw new IllegalArgumentException( "The key must contains letters and dash" );
        }
        // Check value is ASCII
        for ( char c : value.toCharArray() ) {
            if ( c < 32 || c > 127 ) {
                throw new IllegalArgumentException( "The metadata value is not ASCII encoded" );
            }
        }
        map.put( key, value );
    }
1237474
public synchronized boolean add(String key, T value) {
        if (key.length() > 3 && key.endsWith(WILDCARD) && key.charAt(key.length() - 2) != '.') {
            throw new IllegalArgumentException("Unsupported use of wildcard in key " + key);
        }

        // Find the key in the structure (build out to it)
        Node<T> current = internalFind(key, false);

        // Return false if the key already exists
        if (current.getValue() != null)
            return false;

        // Set the value and return true
        current.setValue(value);
        return true;
    }
71763
@Override
    public Object getValue(@NonNull String key) {
        if (key == null) { throw new IllegalArgumentException("key cannot be null."); }

        final int index = indexForColumnName(key);
        return index >= 0 ? getValue(index) : null;
    }
981468
public <T> void setHintValue(Hint<T> hint, T value) {
		if (value == null) {
			throw new IllegalArgumentException("Null value passed.");
		}
		hintValues.put(hint, value);
	}
948394
@Override
    synchronized public V put(K key, V value) {
        V oldValue = this.get(key);
        try {
            super.put(key, value);
            writeBack(key, value);
            return oldValue;
        } catch(Exception e) {
            super.put(key, oldValue);
            writeBack(key, oldValue);
            throw new VoldemortException("Failed to put(" + key + ", " + value
                                         + ") in write through cache", e);
        }
    }
431211
private void validateEntry(String key, Object value) {
        if (isBlank(key)) {
            throw new IllegalArgumentException("key cannot be null/blank");
        }
        if (ModifiedUTF8Charset.calculateByteLength(key) > 255) {
            throw new IllegalArgumentException("key length > 255 bytes");
        }
        else if (value == null) {
            throw new IllegalArgumentException("value cannot be null");
        }
        else if (value instanceof String) {
            if (ModifiedUTF8Charset.calculateByteLength((String) value) > 32767) {
                throw new IllegalArgumentException("string value length > 34767 bytes");
            }
        }
        else if (value instanceof Integer ||
                 value instanceof Long ||
                 value instanceof Double) {
            // valid
        } else {
            throw new IllegalArgumentException("Illegal value type: "+value.getClass().toString());
        }
    }
167496
protected void insertNewKeyValueAt(int i, short key, Container value) {
    extendArray(1);
    System.arraycopy(keys, i, keys, i + 1, size - i);
    keys[i] = key;
    System.arraycopy(values, i, values, i + 1, size - i);
    values[i] = value;
    size++;
  }
497127
private String getValue(String key, String previousValue) {
        final String value;
        final String valueUpdated = toSave.getProperty(key);
        if (valueUpdated == null) {
            value = previousValue;
        } else {
            value = valueUpdated;
        }
        return value;
    }
99710
public void setValue(final Object value) {
        if (!(value instanceof Serializable)) {
            throw new IllegalArgumentException("The value muste be a instance of " + Serializable.class.getName());
        }
        this.value = (Serializable) value;
    }
1246480
@Override
	public final boolean put(String key, Bitmap value) {
		if (key == null || value == null) {
			throw new NullPointerException("key == null || value == null");
		}

		synchronized (this) {
			size += sizeOf(key, value);
			Bitmap previous = map.put(key, value);
			if (previous != null) {
				size -= sizeOf(key, previous);
			}
		}

		trimToSize(maxSize);
		return true;
	}
400809
@SuppressWarnings("unchecked")
    @Override
    public Object put(Object key, Object value) {
        if (MESSAGE_LOCALE.equals(key)) {
            if (value instanceof Locale) {
                locale = (Locale) value;
                data.put(MESSAGE_LOCALE, value);
            } else {
                throw new IllegalArgumentException();
            }
            if (installKernelMap != null)
                installKernelMap.put(key, value);
            return value;
        }
        if (installKernelMap == null) {
            if (RUNTIME_INSTALL_DIR.equals(key)) {
                if (value instanceof File) {
                    return data.put(RUNTIME_INSTALL_DIR, value);
                } else {
                    throw new IllegalArgumentException();
                }
            } else if (INSTALL_MAP_JAR.equals(key)) {
                if (value instanceof String) {
                    return data.put(INSTALL_MAP_JAR, value);
                } else {
                    throw new IllegalArgumentException();
                }
            } else if (INSTALL_MAP_JAR_FILE.equals(key)) {
                if (value instanceof File) {
                    return data.put(INSTALL_MAP_JAR_FILE, value);
                } else {
                    throw new IllegalArgumentException();
                }
            } else if (OVERRIDE_JAR_BUNDLES.equals(key)) {
                if (value instanceof List) {
                    return data.put(OVERRIDE_JAR_BUNDLES, value);
                } else {
                    throw new IllegalArgumentException();
                }
            } else {
                data.put(INSTALL_KERNEL_INIT_CODE, ERROR);
                data.put(INSTALL_KERNEL_INIT_ERROR_MESSAGE, getMessage("MAPBASED_ERROR_KERNEL_NOT_INIT"));
                throw new RuntimeException(getMessage("MAPBASED_ERROR_KERNEL_NOT_INIT"));
            }
        } else {
            return installKernelMap.put(key, value);
        }
    }
1080551
@SuppressWarnings("unchecked")
    public V put(final int key, final V value)
    {
        final V val = (V)mapNullValue(value);
        requireNonNull(val, "value cannot be null");

        V oldValue = null;
        @DoNotSub final int mask = values.length - 1;
        @DoNotSub int index = Hashing.hash(key, mask);

        while (null != values[index])
        {
            if (key == keys[index])
            {
                oldValue = (V)values[index];
                break;
            }

            index = ++index & mask;
        }

        if (null == oldValue)
        {
            ++size;
            keys[index] = key;
        }

        values[index] = val;

        if (size > resizeThreshold)
        {
            increaseCapacity();
        }

        return unmapNullValue(oldValue);
    }