This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes RecordComparator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "RecordComparator" Watch "RecordComparator" New topic


Greg Schwartz
Ranch Hand

Joined: May 11, 2003
Posts: 132
Does anyone know why, if two records with equivalent values (ie. same dates) are sorted using the RecordComparator by those values, the second value entered always comes before the first one in the final sorted order.
It seems that it should work the opposite such that if two values (which the RecordComparator is sorting by) are equivalent, the most recently added value would be returned after the previous one of equivalent value in the final sorted order.
To try and solve this problem, I tried making the "equivalent" case in the RecordComparator's compare function return "PRECEEDS" instead of "EQUIVALENT", but this only caused other problems and greatly disturbed the sorted order.
If anyone knows why this design decision was made or has any ideas on how to reverse the order in which two equivalent values are returned in for enumeration, I'd greatly appreciate your help.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: RecordComparator
It's not a secret anymore!