sorting on a hash table

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.
 
P

Peter Duniho

[...]
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
 
P

Paul

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top