/** * Inserts a key/value pair into the map if the key does not already exist. * * @param key * an <code>Object</code> value * @param value * an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, or null if none * was found. */ public Object putIfAbsent(Object key, Object value) { if (null != key) { final Object oldKey; final int index = insertionIndex(key); if (index >= 0) { oldKey = _set[index]; _set[index] = key; _values[index] = value; postInsertHook(oldKey == null); return null; } else { return _values[-index - 1]; } } else { throw new NullPointerException("null keys not supported"); } }
value = valueCreator.create(key, params); _values[index] = value; postInsertHook(oldKey == null); return null;
value = valueCreator.create(key, params); _values[index] = value; postInsertHook(oldKey == null); return value;