An Interview Question

Given the following:

// ReadOnlyMap.java
public interface ReadOnlyMap<K, V> {        
    V get(K key);
}

// ReadWriteMap.java
public interface ReadWriteMap<K, V> {
    V get(K key);
    V put(K key, V value);
}

// MapFactory.java
public interface MapFactory {
    ReadOnlyMap<K, V> createReadOnlyMap(java.util.Map<K, V> map);
    ReadWriteMap<K, V> createReadWriteMap(java.util.Map<K, V> map);
}

Provide thread-safe implementations of ReadOnlyMap & ReadWriteMap and an implementation of MapFactory to create instances of these custom maps.

Bonus question: provide an implementation of ReadWriteMap optimized for read dominated workloads.

There is no single right answer. Just like there is no single wrong answer!

I think the above will work as a decent interview question for intermediate level Java developers. Agree or Disagree?