TimeBasedExpiringValueMap { public V remove(K key) { TimedKeyValue<K, V> v = map.remove(key); if (v != null) { return v.getValue(); } return null; } TimeBasedExpiringValueMap(TimeService timeService);  TimeBasedExpiringValueMap(TimeService timeService, long timeoutMilliseconds); void put(K key, V value); V get(K key); V remove(K key); int size(); void clear(); static final long DEFALT_TIMEOUT; }
@Test public void remove() { map.put(key1, value1); assertSame(value1, map.remove(key1)); assertEquals(0, map.size()); }
@Test public void non_existent_remove() { assertNull(map.remove("does-not-exist")); }