[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sorting arrays
Hi Wade,
Can you post your class that implements the Comparator
interface ? I think that it is quite possible to
modify that class to achieve your goal.
Johnny
--- Wade Steele <wsteele3@csc.com> wrote:
> 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
>
=====
Johnny Ren
Software Engineer
http://johnnyren.dyndns.org:8080/index.html
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com