class ConcurrentLazyMap extends LazyMap<K, V> {

    @Override
    public V get(Object key, Factory<? super K, ? extends V> factory)
    {
        Utilities.checkNull(factory, "factory");
        if (key != null && !getKeyType().isInstance(key))
        {
            return getIfExists(key);
        }
        V value = getIfExists(key);
        if (value != null)
        {
            return value;
        }

        @SuppressWarnings("unchecked")
        K k = (K)key;

        Lock lock = getLock(k);
        lock.lock();
        try
        {
            // Check again.
            value = getIfExists(key);
            if (value == null)
            {
                value = factory.create(k);
                getMap().put(k, value);
            }
            return value;
        }
        finally
        {
            lock.unlock();
        }
    }

    public  ConcurrentLazyMap(Map<K, V> map, Class<? extends K> keyType);
    public  ConcurrentLazyMap(Map<K, V> map, Class<? extends K> keyType, Factory<? super K, ? extends V> factory);

}