/** * Remove a pair from the mapping. This operation removes a (key,id) pair from the mapping. * * @param key is the key whose id is to be released */ public void dropPair(long key) { int id = ht.lookup(key); if (id == 0) return; ht.remove(key); ids.swap(id); cnt--; }
/** * Get the id for a given key. * * @param key is the key for which the id is required * @return the corresponding id or 0 if the key is not mapped or the operation fails */ public int getId(long key) { return ht.lookup(key); }
/** * Determine if a given key has been mapped to an identfier. * * @param key is the key to be checked * @return true if the key has been mapped, else false */ public boolean validKey(long key) { return (ht.lookup(key) != 0); }