/** * retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public double get(Object key) { int index = index(key); return index < 0 ? (double)0 : _values[index]; }
/** * Adjusts the primitive value mapped to key. * * @param key the key of the value to increment * @param amount the amount to adjust the value by. * @return true if a mapping was found and modified. */ public boolean adjustValue(Object key, double amount) { int index = index(key); if (index < 0) { return false; } else { _values[index] += amount; return true; } }
/** * Deletes a key/value pair from the map. * * @param key an <code>Object</code> value * @return an <code>double</code> value */ public double remove(Object key) { double prev = (double)0; int index = index(key); if (index >= 0) { prev = _values[index]; removeAt(index); // clear key,state; adjust size } return prev; }
public final boolean execute(Object key, double value) { int index = _otherMap.index(key); if (index >= 0 && eq(value, _otherMap.get(key))) { return true; } return false; }