K - The type of the key of the cacheV - The type of the values in the cachepublic class Cache<K,V> extends Object implements Computable<K,V>
| Modifier and Type | Class and Description |
|---|---|
static interface |
Cache.CycleHandler<K>
Should a cycle be detected during computation of a value
for given key, this interface allows client code to register
a callback that would get invoked in such a case.
|
| Constructor and Description |
|---|
Cache(Computable<K,V> computable)
Create new cache with given computable to compute values.
|
Cache(Computable<K,V> computable,
Cache.CycleHandler<K> cycleHandler)
Create new cache with given computable and cycle handler.
|
public Cache(Computable<K,V> computable)
computable - public Cache(Computable<K,V> computable, Cache.CycleHandler<K> cycleHandler)
computable - cycleHandler - public V compute(K key)
Computablecompute in interface Computable<K,V>key - input data.public void clear()
public boolean containsKey(K key)
key - public void remove(K key)
key - item key.Copyright © 2009-2013 Oracle Corporation. All Rights Reserved.