/** * Deletes a key/value pair from the map. * * @param key an <code>double</code> value * @return an <code>float</code> value, or (float)0 if no mapping for key exists */ public float remove(double key) { float prev = 0; int index = index(key); if (index >= 0) { prev = _values[index]; removeAt(index); // clear key,state; adjust size } return prev; }
/** * Retains only those entries in the map for which the procedure returns a true value. * * @param procedure determines which entries to keep * @return true if the map was modified. */ public boolean retainEntries(TDoubleFloatProcedure procedure) { boolean modified = false; byte[] states = _states; double[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0; ) { if (states[i] == FULL && !procedure.execute(keys[i], values[i])) { removeAt(i); modified = true; } } return modified; }