// Collection of code snippets by Arne VajhÃ¸j 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.Collator;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Locale;

public class CollationFun {
    public static void sort(String[] sa, Locale loc) {
        System.out.println(loc.getDisplayLanguage() + ":");
        final Collator col = Collator.getInstance(loc);
        Arrays.sort(sa, new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                return col.getCollationKey(s1).compareTo(col.getCollationKey(s2));
            }
        });
        for(String s : sa) {
            System.out.println(s);
        }
    }
    public static void main(String[] args) {
        String[] sa = { "a", "c", "e", "z", "é", "è", "æ", "ø", "å", "ç" };
        sort(sa, Locale.ENGLISH);
        sort(sa, Locale.FRENCH);
        sort(sa, new Locale("da"));
    }
}
