Code example for HashMap

Methods: remove, size

0
    public final int size() { 
        return elements.size();
    } 
 
    public final synchronized boolean removeValue(T value) {
    	assert(elements.size() == valueToElement.size());
    	Element<T> e = valueToElement.remove(value);
    	if(e == null) return false;
    	elements.remove(e);
    	assert(elements.size() == valueToElement.size());
    	return true; 
    } 
     
    public final synchronized boolean containsValue(T key) {
    	return valueToElement.containsKey(key);
    } 
     
    /** 
     * Note that this does not automatically promote the key. You have 
     * to do that by hand with push(key, value). 
     */