I would like to avoid class loader leaks due to un-removed listeners. To facilitate this i believe weak or soft references to listeners would help. Strictly the only Collection methods i need are add() and iterator().
Are there any foss libraries with a Set or List that uses Weak or Soft References.
Any suggestions would be appreciated, otherwise i will write my own.
You could actually use
WeakHashSetfor this purpose. Just usenullfor all of the values.EDIT
WeakHashMap for WeakHashSet and Boolean.TRUE for values.