andymrhu / corporateaddressbook

Automatically exported from code.google.com/p/corporateaddressbook
0 stars 0 forks source link

Results sorting #60

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
sorting is case sensitive, hence names all in capitals are shown before names 
only with the first letter capital regardless of the rest of the name.

Original issue reported on code.google.com by viveki...@gmail.com on 4 Jun 2011 at 12:00

GoogleCodeExporter commented 8 years ago
This can be fixed by the following (affected files also attached):
CorparateAddressBook.java [private void displayResult()]:
-426   Arrays.sort(names);
+426   Arrays.sort(names, new CaseInsesitiveCompare()); //Use a comparator

+CaseInsesitiveCompare.java [new file]:
package net.vivekiyer.GAL.wbxml;

import java.util.Comparator;

public class CaseInsesitiveCompare implements Comparator<String> {
    @Override
    public int compare(String str1, String str2) {
        return str1.compareToIgnoreCase(str2);
    }
}

If I could also make a suggestion, perhaps use proper case on all names ("Jane 
Smith") (as an option?), it is a little difficult to read now that all the case 
is jumbled up.

Original comment by brocky1...@gmail.com on 16 Jun 2011 at 12:42

Attachments:

GoogleCodeExporter commented 8 years ago
Correction to the previous message:
the first line of CaseInsesitiveCompare.java should be
package net.vivekiyer.GAL;
not
package net.vivekiyer.GAL.wbxml;

This is correct in the attached file, just a copy/paste error.

Original comment by brocky1...@gmail.com on 16 Jun 2011 at 3:44

GoogleCodeExporter commented 8 years ago
Thanks Rocky

I will pull these changes in into the next release. Will you be interested in 
contributing to this project?

Original comment by viveki...@gmail.com on 20 Jul 2011 at 9:43

GoogleCodeExporter commented 8 years ago
It is a project that I am interested in and would like to see with more
features, but having a thesis to write amongst other things I am a bit short
on time.
I can try to help out whenever possible, but that may not be very much.

Original comment by brocky1...@gmail.com on 22 Jul 2011 at 9:06