/** * Inserts a key/value pair into the map. * * @param key an <code>short</code> value * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, or (short)0 if none was found. */ public long put(short key, long value) { int index = insertionIndex(key); return doPut(key, value, index); }
/** * Inserts a key/value pair into the map if the specified key is not already associated with a * value. * * @param key an <code>short</code> value * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, or (short)0 if none was found. */ public long putIfAbsent(short key, long value) { int index = insertionIndex(key); if (index < 0) return _values[-index - 1]; return doPut(key, value, index); }