ConcurrentLRUCache { public V put(K key, V value) { int hash = hash(key.hashCode()); return segmentMapFor(hash).put(key, value); } ConcurrentLRUCache();  ConcurrentLRUCache(int maxCapacity);  ConcurrentLRUCache(int maxCapacity, float loadFactor);  ConcurrentLRUCache(int maxCapacity, float loadFactor, int segments); void clear(); boolean containsKey(Object key); V get(Object key); boolean isEmpty(); V put(K key, V value); V remove(Object key); int size(); @Override String toString(); static final int DEFAULT_SEGMENTS; static final float DEFAULT_LOAD_FACTOR; }
@Test public void testPut() { for (int i = 0; i < 10; ++i) { String key = i + ""; String value = i + ""; cache.put(key, value); } for (int i = 0; i < 10; ++i) { String key = i + ""; String value = i + ""; Assert.assertEquals(value, cache.get(key)); } Assert.assertEquals(10, cache.size()); }