Why there is no WeakList and WeakSet implementation in Java? [duplicate]
... at least not "official".
You can easily google two or three "WeakList" example implementation and for "WeakSet" one very good can be found in NetBeans Platform API sources.
I read similar question placed here asking for WeakSet. Answers were "there is no usecase for WeakSet". If it will be like this why these unofficial implementations exist?
Perhaps you can get one by using Collections.newSetFromMap(new WeakHashMap())
. Many collections don't exist as public classes (if they are not-so-important), but can be obtained by the Collections
factory methods.
精彩评论