Java Collections sort using String.CASE_INSENSITIVE_ORDER
import java.util.Arrays; import java.util.Collections; import java.util.List; public class Main { public static void main(String[] argv) throws Exception { String[] strArray = new String[] { "CSS", "css", "CSS", "HTML","demo2s.com","Demo2s.com" }; List<String> list = Arrays.asList(strArray); System.out.println(list);//ww w. java 2 s . c om Collections.sort(list); System.out.println(list); Collections.sort(list, String.CASE_INSENSITIVE_ORDER); System.out.println(list); Collections.sort(list, Collections.reverseOrder()); System.out.println(list); Collections.sort(list, String.CASE_INSENSITIVE_ORDER); System.out.println(list); } }