@Test public void testList() { RecentObjectCache cache = new RecentObjectCache(); cache.add(LayerGroupInfo.class, map("one")); cache.add(LayerGroupInfo.class, map("two")); cache.add(LayerGroupInfo.class, map("three")); Iterator<Ref> it = cache.list(LayerGroupInfo.class).iterator(); assertTrue(it.hasNext()); assertEquals("three", it.next().id); assertTrue(it.hasNext()); assertEquals("two", it.next().id); assertTrue(it.hasNext()); assertEquals("one", it.next().id); }
public <T extends Info> Iterable<Ref> list(Class<T> clazz) { List<Ref> list = null; EvictingQueue<Ref> q = q(clazz); synchronized (q) { list = new ArrayList(q); } Collections.reverse(list); return new LinkedHashSet<>(list); }
RecentObjectCache { public <T extends Info> Iterable<Ref> list(Class<T> clazz) { List<Ref> list = null; EvictingQueue<Ref> q = q(clazz); synchronized (q) { list = new ArrayList(q); } Collections.reverse(list); return new LinkedHashSet<>(list); } }
RecentObjectCache { public <T extends Info> Iterable<Ref> list(Class<T> clazz) { List<Ref> list = null; EvictingQueue<Ref> q = q(clazz); synchronized (q) { list = new ArrayList(q); } Collections.reverse(list); return new LinkedHashSet<>(list); } RecentObjectCache();  RecentObjectCache(final int size); }
RecentObjectCache { public <T extends Info> Iterable<Ref> list(Class<T> clazz) { List<Ref> list = null; EvictingQueue<Ref> q = q(clazz); synchronized (q) { list = new ArrayList(q); } Collections.reverse(list); return new LinkedHashSet<>(list); } RecentObjectCache();  RecentObjectCache(final int size); void add(Class<T> clazz, T obj); void add(Class<T> clazz, T obj, String workspace); Iterable<Ref> list(Class<T> clazz); boolean remove(Class<T> clazz, T obj); }
RecentObjectCache { public <T extends Info> Iterable<Ref> list(Class<T> clazz) { List<Ref> list = null; EvictingQueue<Ref> q = q(clazz); synchronized (q) { list = new ArrayList(q); } Collections.reverse(list); return new LinkedHashSet<>(list); } RecentObjectCache();  RecentObjectCache(final int size); void add(Class<T> clazz, T obj); void add(Class<T> clazz, T obj, String workspace); Iterable<Ref> list(Class<T> clazz); boolean remove(Class<T> clazz, T obj); static final int DEFAULT_SIZE; }