sorting on a hash table

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi have data in a hash table that I copy into an array list. The data is in
the form
name(string)
number(string)-because it can have some letters in it
user(string)
starttime(datetime)
endtime(datetime)

I want to sort it by name and then starttime,could you do this from the
arraylist?
thanks.
 
[...]
I want to sort it by name and then starttime,could you do this from the
arraylist?

Yes, of course. Just write a comparer that takes those fields into
consideration in the order you want. Return the result of comparing the
name, unless the names are equal in which case return the result of
comparing the starttime.

This is not a lot different from some of the sorting examples that were
offered to you in a previous thread related to this data you've got.

Pete
 
thanks for the additional information, will look at the previous thread as
well!
--
Paul G
Software engineer.


Peter Duniho said:
[...]
I want to sort it by name and then starttime,could you do this from the
arraylist?

Yes, of course. Just write a comparer that takes those fields into
consideration in the order you want. Return the result of comparing the
name, unless the names are equal in which case return the result of
comparing the starttime.

This is not a lot different from some of the sorting examples that were
offered to you in a previous thread related to this data you've got.

Pete
 
Back
Top