So you have the same data stored in several ordered collections and when one collection is sorted then all the other ordered collections should be sorted. Change everything to use just one common ordered collection.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
See if I got the problem. You might have three collections of the same objects or maybe even different objects. If they are the very same objects, use the suggestion above to put everything in one collection if you can. Let's say they are different objects and they are students. You can sort by name or age or student id number and so on. When you sort one collection you want the others to be sorted by the same key.
I don't think you'll find anything automated to do that. But you can build something to make it happen.
What first comes to mind is an Observable object that holds the current sort order, and an Observer for each collection. When you change the sort order the Observable notifies the Observers, and they update their particular collection. Are you familiar with the observer pattern and the Observer and Observable classes in Java?
I'm cursious how you'll do the sorting, too. Maybe a Comparator for name order, another for age order, and so on? [ July 21, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi