D
Dan H.
Hello,
I have an application that requires a collection that is sorted by a double
field first, and then by a long field.
So, lets say I have an class that has 2 fields called time, priority. I
want to put a bunch of those classes into a collection and have that
collection always stay sorted by time first, then priority. The last object
in the list should be the lowest time, highest priority object, etc, for
easy picking.
Object Time Priority
4 105 56
5 105 98
6 105 100
1 100 98
2 100 99
3 100 100
Anyone have any advice on how they would design this? My current
implementation uses a single arraylist and when i insert an object, I divide
and conquer to find where I should insert. I need to find a faster solution
and was hoping someone has done some research into this already in the past.
I thank you in advance,
Dan
I have an application that requires a collection that is sorted by a double
field first, and then by a long field.
So, lets say I have an class that has 2 fields called time, priority. I
want to put a bunch of those classes into a collection and have that
collection always stay sorted by time first, then priority. The last object
in the list should be the lowest time, highest priority object, etc, for
easy picking.
Object Time Priority
4 105 56
5 105 98
6 105 100
1 100 98
2 100 99
3 100 100
Anyone have any advice on how they would design this? My current
implementation uses a single arraylist and when i insert an object, I divide
and conquer to find where I should insert. I need to find a faster solution
and was hoping someone has done some research into this already in the past.
I thank you in advance,
Dan