@Test public void create_evictLeastRecentlyAccessed() { final Set<Integer> set = LimitedSet.create(2); set.add(1); assertThat(set.size()).isEqualTo(1); set.add(2); assertThat(set.size()).isEqualTo(2); set.add(1); set.add(3); assertThat(set.size()).isEqualTo(2); assertThat(set.contains(3)).isTrue(); assertThat(set.contains(1)).isTrue(); }
public static <T> Set<T> create(final int maxSize) { return Collections.newSetFromMap(LimitedMap.create(maxSize)); }
LimitedSet { public static <T> Set<T> create(final int maxSize) { return Collections.newSetFromMap(LimitedMap.create(maxSize)); } }
LimitedSet { public static <T> Set<T> create(final int maxSize) { return Collections.newSetFromMap(LimitedMap.create(maxSize)); } private  LimitedSet(); }
LimitedSet { public static <T> Set<T> create(final int maxSize) { return Collections.newSetFromMap(LimitedMap.create(maxSize)); } private  LimitedSet(); static Set<T> create(final int maxSize); }
LimitedSet { public static <T> Set<T> create(final int maxSize) { return Collections.newSetFromMap(LimitedMap.create(maxSize)); } private  LimitedSet(); static Set<T> create(final int maxSize);  }