Why is there no implementation of WeakList and WeakSet in Java?

... at least not "official."

You can easily run two or three versions of "WeakList" on Google, but for "WeakSet" you can very well find sources in the NetBeans platform API .

I read a similar question posted here asking for WeakSet. The answers were "no need for WeakSet." If so, why do these unofficial implementations exist?

+7
source share
1 answer

Perhaps you can get it using Collections.newSetFromMap(new WeakHashMap()) . Many collections do not exist as public classes (if they are not so important), but can be obtained using the Collections factory methods.

+8
source

All Articles