Is it possible to sort the days of the week?
I have a Map where the keys are days of the week. i.e. values returned from DateMidnight.dayOfWeek();
I wanted to iterate over the days of the week in order and get the values for that day, like so
Map byWeekday;
List daysOfWeek=new ArrayList(byWeekday.keySet());
Collections.sort(daysOfWeek);
for (Iterator iterator = daysOfWeek.iterator(); iterator.hasNext();)
{
However, it turns out that DateMidnight.Property does not implement Comparable, so I get a ClassCastException when I try to sort the days of the week.
It seems to make sense that the days of the week should implement Comparable; there may be complications with working out when the week starts and ends, but otherwise this seems straightforward.
Or is there another way of doing this?
_____________________________________________________________________
This email message (including any file attachments transmitted with it) is for the sole use of the individual or entity to whom it is addressed and may contain confidential and privileged information. Any unauthorised review, use, alteration, disclosure or distribution is prohibited. If you have received this email in error, please notify the sender by return email and destroy all copies of the original message.
Any confidentiality or legal professional privilege is not waived or lost by any mistaken delivery of the email.
Opinions, conclusions and other information in this message that do not relate to the official business of the company shall be understood as neither given nor endorsed by it.
_______________________________________________ Joda-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/joda-interest
