This content has been marked as final. Show 3 replies
is it possible to have a set that is:
- observable (I want to be notified when a change occurs)
- copyOnWrite (I access the collection from multiple threads)
- sorted as TreeSet (I want the collection to be always sorted)
There should not be anything stopping you from writing a class that implements SortedSet and Observable.
I can imagine
encapsulating a TreeSet wrapped in a CopyOnWriteArrayList or
encapsulating a CopyOnWriteArrayList wrapped in a TreeSet
but you would have to do some research
how best to implement it.
Edit: Bah, those don't wrap an underlying collection
Edited by: tschodt on Feb 17, 2012 12:39 PM
ConcurrentSkipListSet may get you most of the way there (you would need to add the observable support yourself).1 person found this helpful
Good but it would be nice to have FXCollections.observableSet(...)