Search in sources :

Example 66 with Collator

use of java.text.Collator in project cytoscape-api by cytoscape.

the class AbstractCyNetworkReader method sort.

private void sort(final List<String> names) {
    if (!names.isEmpty()) {
        final Collator collator = Collator.getInstance(Locale.getDefault());
        Collections.sort(names, new Comparator<String>() {

            @Override
            public int compare(String s1, String s2) {
                if (s1 == null && s2 == null)
                    return 0;
                if (s1 == null)
                    return -1;
                if (s2 == null)
                    return 1;
                return collator.compare(s1, s2);
            }
        });
    }
}
Also used : Collator(java.text.Collator)

Aggregations

Collator (java.text.Collator)66 ArrayList (java.util.ArrayList)14 RuleBasedCollator (java.text.RuleBasedCollator)7 HashMap (java.util.HashMap)7 List (java.util.List)5 GraphObject (com.facebook.model.GraphObject)4 Comparator (java.util.Comparator)4 Context (android.content.Context)3 InputMethodInfo (android.view.inputmethod.InputMethodInfo)3 HashSet (java.util.HashSet)3 LinkedHashMap (java.util.LinkedHashMap)3 Entry (java.util.Map.Entry)3 TreeMap (java.util.TreeMap)3 SharedPreferences (android.content.SharedPreferences)2 ApplicationInfo (android.content.pm.ApplicationInfo)2 PackageInfo (android.content.pm.PackageInfo)2 DBObject (com.mongodb.DBObject)2 SMSException (com.sun.identity.sm.SMSException)2 ServiceSchema (com.sun.identity.sm.ServiceSchema)2 AutoPilot (com.ximpleware.AutoPilot)2