Java case insensitive localized ordering
问题 I have set of hyphenated string sets. That I want to sort considering the locale. List<String> words = Arrays.asList("App - Small", "Apple", "App - Big"); Collator collator = Collator.getInstance(new Locale("en")); // Sort Method 1 Collections.sort(words, String.CASE_INSENSITIVE_ORDER); System.out.println(words.toString()); // Sort Method 2 collator.setStrength(Collator.PRIMARY); Collections.sort(words, collator); System.out.println(words.toString()); Result String.CASE_INSENSITIVE_ORDER [App