|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openarchitectureware.workflow.util.IdentityCacheWithoutNull<K,V>
K
- The type for the cache's keyV
- The type for the cache's valuepublic abstract class IdentityCacheWithoutNull<K,V>
This cache treats keys as the same only if they are identical: (key1 == key2) This cache does not store null values, which means that if createNew(key) returns null for a specific key the result is not cached and createNew(key) is called again every time the key's value is requested. Not to cache the null-value provides the advantage that a single lookup in the internal HashMap "get()" is enough to server one request. Otherwise it would be necessary to do a "containsKey()" first and then the "get()" which costs the time of two lookups.
Constructor Summary | |
---|---|
IdentityCacheWithoutNull()
|
Method Summary | |
---|---|
protected abstract V |
createNew(K 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 IdentityCacheWithoutNull()
Method Detail |
---|
protected abstract V createNew(K key)
public V get(K key)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |