Question: Hi  

Is the class below threadsafe?

```
class ImmutablePossiblyThreadsafeClass<K, V> {

    private final Map<K, V> map;

    public ImmutablePossiblyThreadsafeClass(final Map<K, V> map) {
        this.map = new HashMap<K, V>();

        for (Entry<K, V> entry : map.entrySet()) {
            this.map.put(entry.getKey(), entry.getValue());
        }
    }

    public V get(K key) {
        return this.map.get(key);
    }
}

```

Answer: 
Yes, it is thread-safe. It is immutable so no thread can make any changes that will interfere with the results for another thread.

Note: If the map is modified during construction, you won't get the contents you thought you passed, but when accessing the map afterwards, it will be thread-safe.
Class itself **is** thread-safe. 

Content of the map contained with the class **is not**. Client can change the entry after getting it. Does it make the whole class thread-safe depends on the logical relationship between this class and V.