Last active
December 24, 2015 14:58
-
-
Save lukasz-zak/6816005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Cache<K, V> { | |
private Map<K, __________<V>> internalCache = new HashMap<>(); | |
public V get(K key, ___________<V> calledWhenAbsent) throws Exception { | |
_____________<V> something = internalCache.get(key); | |
V result; | |
if (something == null || something.get() == null) { | |
result = calledWhenAbsent.call(); | |
internalCache.put(key, new _____________<V>(result)); | |
} else { | |
result = something.get(); | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment