开发者

Why there is no WeakList and WeakSet implementation in Java? [duplicate]

This question already has answers here: W开发者_如何学Pythonhy does exist WeakHashMap, but absent WeakSet? (2 answers) Closed 5 years ago.

... 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜