public Collection<V> values() {
    Set<Map.Entry<K, CachedValue<V>>> entrySet = cache.entrySet();
    List<K> expiredKeys = new ArrayList<K>(128);
    Collection<V> result = new ArrayList<V>(entrySet.size());
    for (Map.Entry<K, CachedValue<V>> entry : entrySet) {
      CachedValue<V> cachedVal = entry.getValue();
      if (cachedVal.isExpired()) {
        expiredKeys.add(entry.getKey());
      } else {
        result.add(cachedVal.get());
      }
    }
    for (K key : expiredKeys) {
      remove(key);
    }
    return result;
  }