Class WeakList<T>

Type Parameters:
T - the type of elements held in this collection
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>

public final class WeakList<T> extends UnsafeWeakList<T>
Implementation of the Collection interface which:
  • Stores elements using weak semantics (see WeakReference)
  • Automatically reclaims storage for garbage collected elements
  • Is thread safe
  • Is NOT RandomAccess, because garbage collector can remove element at any time
  • Does NOT support null elements
Please note that since weak references can be collected at any time, index-based methods (like get(index)) or size-based methods (like size()) are dangerous, misleading, error-inducing and are not supported. Instead, please use add(T) and iterator().