/** * Finds a value based on a predicate. * * @param predicate the condition to match * @return the first value from the cache that matches according to the given * predicate or <code>null</code> if no value matches */ public final V find(Predicate<V> predicate) { if (predicate != null) { for (CacheEntry<K, V> entry : cache.values()) { if (predicate.accept(entry.getValue())) { return entry.getValue(); } } } return null; }