|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pojomatic.internal.SelfPopulatingMap<K,V>
public abstract class SelfPopulatingMap<K,V>
A thread-safe "map" which generates values on demand, with the guarantee that no more than one
value will be auto-created for a given key.
Classes extending this class should override create(Object)
.
Constructor Summary | |
---|---|
SelfPopulatingMap()
|
Method Summary | |
---|---|
protected abstract V |
create(K key)
Create a value for a key. |
V |
get(K key)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SelfPopulatingMap()
Method Detail |
---|
public V get(K key)
protected abstract V create(K key)
get(Object)
when there is not
already an existing value, and no other thread is already creating a value for that key.
The value returned must not be null.
key
- the key to create the value for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |