Re: Comparator in the driver



On Wed, 30 Apr 2008 08:11:35 GMT, thufir <hawat.thufir@xxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :

This driver is horribly embarrassing, but leaving aside its jumbledness,
why is the Comparator not sorting? I want to sort guestsByCity using the
Comparator BY_CITY.

I have pointed you repeatedly to working code. Compare your code with
that, or take my code and gradually morph it to do what you want.

see http://mindprod.com/jgloss/sort.html
http://mindprod.com/jgloss/comparator.html
http://mindprod.com/jgloss/comparable.html
http://mindprod.com/jgloss/generics.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.



Relevant Pages

  • Re: I require a Sortable JTable. Please Help.
    ... >> implements sorting by handling a mouse click on the Table headers. ... > convenience) and a comparator for comparing rows in a table (where each ... > row is a distinct object), based on the criteria provided by the header ... > AbstractSortableTableModel class and fill in the gaps. ...
    (comp.lang.java.programmer)
  • Re: Sorting objects in ooRex? is this possible with data structures?
    ... The sorting features are modeled off of what Java does with its Comparable and Comparator classes. ... If you want to sort on different column positions, we have a Comparator class that allows you to specify the comparison colums. ... Here's one that compares strings as numbers: ...
    (comp.lang.rexx)
  • Re: Should equals() and compareTo() be equivalent to test for equality ??
    ... Comparator instead. ... so Comparator's intent seems to be an "outside" version ... The natural ordering of named objects would seem to be alphabetical. ... It's not the sorting algorithm's problem that people foolishly are ...
    (comp.lang.java.programmer)
  • Re: Sorting based on multiple parameters
    ... do comparison for multiple parameters. ... Here is what I need to do - I have object MyObj with several fields. ... how do I write comparator for following method? ... Comparator to do the sorting. ...
    (comp.lang.java.programmer)
  • Re: Sorting data in JTable
    ... sorting works fine. ... put ignoreCase() and toLowerCase, but the result was still the same. ... public void setColumnComparator(Class type, Comparator comparator) ...
    (comp.lang.java.programmer)