A DESCRIPTION OF THE REQUEST :
It would occasionally be useful to create a collection of strong and weak references that can be operated on interchangeably. This is not possible because there is no StrongReference counterpart to java.lang.ref.WeakReference.
JUSTIFICATION :
This enhancement would eliminate the need to introduce additional classes to abstract the difference between WeakReference and an ordinary strong reference. In other words, instead of Collection<Foo> containing instances of StrongFoo and WeakFoo, one could simply use a Collection<Reference>.
The fact that this is not a very common or compelling need is offset by the fact that introducing StrongReference would likely be trivial.
It would occasionally be useful to create a collection of strong and weak references that can be operated on interchangeably. This is not possible because there is no StrongReference counterpart to java.lang.ref.WeakReference.
JUSTIFICATION :
This enhancement would eliminate the need to introduce additional classes to abstract the difference between WeakReference and an ordinary strong reference. In other words, instead of Collection<Foo> containing instances of StrongFoo and WeakFoo, one could simply use a Collection<Reference>.
The fact that this is not a very common or compelling need is offset by the fact that introducing StrongReference would likely be trivial.
- duplicates
-
JDK-4632244 (ref) Need for a StrongReference class for symmetry with WeakReference?
- Closed