public void putAll(Map<? extends K, ? extends V> m) {
        originalMap.putAll(m);
        for (Map.Entry<? extends K,? extends V> e : m.entrySet())
            reverseMap.put(e.getValue(), e.getKey());
    }

    /**
     * {@inheritDoc}
     */
    public V remove(Object key) {
        V removed = originalMap.remove(key);
        if (removed != null)
            reverseMap.remove(removed);
        return removed;
    }

    /**
     * {@inheritDoc}
     */
    public int size() {
        return originalMap.size();
    }

    /**
     * Returns a string description of the mappings.
     */
    public String toString() {
        return originalMap.toString();
    }

    /**
     * {@inheritDoc}
     */
    public Collection<V> values() {
        return originalMap.values();
    }

    private void writeObject(ObjectOutputStream out) throws IOException {
        out.writeInt(originalMap.size());
        for (Map.Entry<K,V> e : originalMap.entrySet()) {
            out.writeObject(e.getKey());
            out.writeObject(e.getValue());
        }
    }

    @SuppressWarnings("unchecked")
    private void readObject(ObjectInputStream in) 
            throws IOException, ClassNotFoundException {
        int size = in.readInt();
        originalMap = new HashMap<K, V>(size);
        reverseMap = new HashMap<V, K>(size);
        for (int i = 0; i < size ; ++i) {
            K k = (K)(in.readObject());
            V v = (V)(in.readObject());
            originalMap.put(k, v);
            reverseMap.put(v, k);
        }            
    }
}
public void putAll ( Map < ? extends K , ? extends V > m ) { originalMap . putAll ( m ) ; for ( Map . Entry < ? extends K , ? extends V > e : m . entrySet ( ) ) reverseMap . put ( e . getValue ( ) , e . getKey ( ) ) ; } public V remove ( Object key ) { V removed = originalMap . remove ( key ) ; if ( removed != null ) reverseMap . remove ( removed ) ; return removed ; } public int size ( ) { return originalMap . size ( ) ; } public String toString ( ) { return originalMap . toString ( ) ; } public Collection < V > values ( ) { return originalMap . values ( ) ; } private void writeObject ( ObjectOutputStream out ) throws IOException { out . writeInt ( originalMap . size ( ) ) ; for ( Map . Entry < K , V > e : originalMap . entrySet ( ) ) { out . writeObject ( e . getKey ( ) ) ; out . writeObject ( e . getValue ( ) ) ; } } @ SuppressWarnings ( "unchecked" ) private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { int size = in . readInt ( ) ; originalMap = new HashMap < K , V > ( size ) ; reverseMap = new HashMap < V , K > ( size ) ; for ( int i = 0 ; i < size ; ++ i ) { K k = ( K ) ( in . readObject ( ) ) ; V v = ( V ) ( in . readObject ( ) ) ; originalMap . put ( k , v ) ; reverseMap . put ( v , k ) ; } } }
{@inheritDoc}