@Test public void create_evictLeastRecentlyAccessed() { final Map<Integer, Integer> map = LimitedMap.create(2); map.put(1, 1); assertThat(map.size()).isEqualTo(1); map.put(2, 2); assertThat(map.size()).isEqualTo(2); map.get(1); map.put(3, 3); assertThat(map.size()).isEqualTo(2); assertThat(map.containsKey(3)).isTrue(); assertThat(map.containsKey(1)).isTrue(); }
public static <K, V> Map<K, V> create(final int maxSize) { return defaultBuilder(maxSize).<K, V>build().asMap(); }
LimitedMap { public static <K, V> Map<K, V> create(final int maxSize) { return defaultBuilder(maxSize).<K, V>build().asMap(); } }
LimitedMap { public static <K, V> Map<K, V> create(final int maxSize) { return defaultBuilder(maxSize).<K, V>build().asMap(); } private  LimitedMap(); }
LimitedMap { public static <K, V> Map<K, V> create(final int maxSize) { return defaultBuilder(maxSize).<K, V>build().asMap(); } private  LimitedMap(); static Map<K, V> create(final int maxSize); static Map<K, V> createSoft(final int maxSize); }
LimitedMap { public static <K, V> Map<K, V> create(final int maxSize) { return defaultBuilder(maxSize).<K, V>build().asMap(); } private  LimitedMap(); static Map<K, V> create(final int maxSize); static Map<K, V> createSoft(final int maxSize);  }