コード例 #1
0
 /**
  * Get the element identified by the key. This method performs a cleanup before getting the
  * element. If the element was not inserted in the cache, or cleaned, null will be returned. If
  * accessOrder is true, the element will be refreshed
  *
  * @param key the key of the element
  * @return the element or null
  */
 @Override
 public synchronized V get(Object key) {
   Cachable<V> value = elements.get(key);
   if (value != null) {
     return value.getObject();
   } else {
     return null;
   }
 }
コード例 #2
0
 @Override
 public Collection<V> values() {
   Collection<Cachable<V>> cachevalues = elements.values();
   Collection<V> values = new ArrayList<V>(cachevalues.size());
   for (Cachable<V> cachevalue : cachevalues) {
     values.add(cachevalue.getObject());
   }
   return values;
 }