@Test public void containsWithGC() { Object objectOne = new Object(); Object objectTwo = new Object(); weakList.add(objectOne); weakList.add(objectTwo); System.gc(); assertThat(weakList, hasItem(objectTwo)); }
@Override public boolean add(T o) { return refs.add(new SoftReference<T>(o)); }
WeakList extends AbstractList<T> { @Override public boolean add(T o) { return refs.add(new SoftReference<T>(o)); } }
WeakList extends AbstractList<T> { @Override public boolean add(T o) { return refs.add(new SoftReference<T>(o)); }  }
WeakList extends AbstractList<T> { @Override public boolean add(T o) { return refs.add(new SoftReference<T>(o)); }  @Override T get(int index); @Override boolean add(T o); @Override void add(int index, T o); @Override void clear(); @Override T remove(int index); @Override T set(int index, T element); @Override boolean contains(Object o); @Override int size(); List<T> getHardReferences(); void removeAllNullElements(); }
WeakList extends AbstractList<T> { @Override public boolean add(T o) { return refs.add(new SoftReference<T>(o)); }  @Override T get(int index); @Override boolean add(T o); @Override void add(int index, T o); @Override void clear(); @Override T remove(int index); @Override T set(int index, T element); @Override boolean contains(Object o); @Override int size(); List<T> getHardReferences(); void removeAllNullElements();  }