String.CASE_INSENSITIVE_ORDER : String sort « Data Type « Java






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[] { "z", "a", "A" };
    List list = Arrays.asList(strArray);
    Collections.sort(list);

    Collections.sort(list, String.CASE_INSENSITIVE_ORDER);

    Collections.sort(list, Collections.reverseOrder());

    Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
    Collections.reverse(list);
  }
}

   
  








Related examples in the same category

1.StrSortCase demonstrates sorting of strings usingStrSortCase demonstrates sorting of strings using
2.Sort array values in case insensitive order
3.Sorting a string List