ExpiringCacheMap { public synchronized Collection<@Nullable V> values() { final Collection<@Nullable V> values = new LinkedList<>(); for (final ExpiringCache<@Nullable V> item : items.values()) { values.add(item.getValue()); } return values; } ExpiringCacheMap(Duration expiry);  ExpiringCacheMap(long expiry); void put(K key, Supplier<@Nullable V> action); void put(K key, ExpiringCache<@Nullable V> item); void putIfAbsent(K key, ExpiringCache<V> item); @Nullable V putIfAbsentAndGet(K key, Supplier<V> action); @Nullable V putIfAbsentAndGet(K key, ExpiringCache<V> item); @SuppressWarnings({ "null", "unused" }) void putValue(K key, @Nullable V value); boolean containsKey(K key); void remove(K key); void clear(); synchronized Set<K> keys(); @SuppressWarnings({ "null", "unused" }) @Nullable V get(K key); synchronized Collection<@Nullable V> values(); @SuppressWarnings({ "null", "unused" }) synchronized void invalidate(K key); synchronized void invalidateAll(); @SuppressWarnings({ "null", "unused" }) synchronized @Nullable V refresh(K key); synchronized Collection<@Nullable V> refreshAll();  }
@Test public void testValues() { subject.put(FIRST_TEST_KEY, CACHE_ACTION); String value1 = subject.get(FIRST_TEST_KEY); assertNotNull(value1); String value2 = subject.get(FIRST_TEST_KEY); assertNotNull(value2); assertEquals(value1, value2); subject.put(SECOND_TEST_KEY, CACHE_ACTION); String value3 = subject.get(SECOND_TEST_KEY); assertNotNull(value3); assertNotEquals(value1, value3); final Collection<String> expectedValues = new LinkedList<>(); expectedValues.add(value3); expectedValues.add(value1); final Collection<String> values = subject.values(); assertEquals(expectedValues, values); String value4 = subject.get("KEY_NOT_FOUND"); assertNull(value4); }