[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sorting arrays
I need some help sorting an array of objects by column name. I'm currently
using the Arrays.sort(Array, Comparator) method. Right now it is sorting
ascending, which is fine. However, I need to sort a date column decending.
Here's the catch. Not all of the objects in the array contain a value in
the date field. That being said, if I sort ascending, the empty ones will
show up at the top of the list, followed by the most recent date, and so
on.
How can I sort this array of objects by the date field so that, whether
ascending or descending, the objects that have do not have date values will
always get tagged on to the bottom of the list? Maybe this isn't possible
without tearing apart the array and removing the ones that don't have
values, sorting the ones with values how I want, and then appending the
empty date objects.
Any help would be appreciated.
thanks
Wade