mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
[HUDSON-3014] case-insensitive sorting with Collator (thanks to Jesse Glick)
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15534 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
abef8b5274
commit
2d107a62f9
1 file changed
+3
-1
@@ -149,6 +149,7 @@ import java.net.URL;
|
||||
import java.security.SecureRandom;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -1009,10 +1010,11 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
|
||||
public Computer[] getComputers() {
|
||||
Computer[] r = computers.values().toArray(new Computer[computers.size()]);
|
||||
Arrays.sort(r,new Comparator<Computer>() {
|
||||
final Collator collator = Collator.getInstance();
|
||||
public int compare(Computer lhs, Computer rhs) {
|
||||
if(lhs.getNode()==Hudson.this) return -1;
|
||||
if(rhs.getNode()==Hudson.this) return 1;
|
||||
return lhs.getDisplayName().toUpperCase().compareTo(rhs.getDisplayName().toUpperCase());
|
||||
return collator.compare(lhs, rhs);
|
||||
}
|
||||
});
|
||||
return r;
|
||||
|
||||
Reference in new issue
Block a user