class SingleValueMapper {

    public synchronized void put(K k, V v) {
        Reject.ifNull(k, v);
        // Clean up previous mapping if present.
        K previousValue = reverse.get(v);
        if (previousValue != null) {
            map.remove(previousValue);
        }

        map.put(k, v);
        reverse.put(v, k);
    }

}