Code example for MapMaker

Methods: makeMap

0
import com.google.common.collect.MapMaker;
 
@Singleton 
public class SimpleLockSystem implements LockSystem { 
 
	final ConcurrentMap<String, Lock> locks = new MapMaker().makeMap();
 
	@Override 
	public Lock getLock(String lockKey) {
		Lock lock = locks.get(lockKey);
		if (lock == null) {
			lock = new SimpleLock();
			Lock existing = locks.put(lockKey, lock);
			if (existing != null) {
				lock = existing;
			} 
		} 
		return lock;
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java