Java String CASE_INSENSITIVE_ORDER

Syntax

String.CASE_INSENSITIVE_ORDER has the following syntax.

public static final Comparator <String> CASE_INSENSITIVE_ORDER

Example

In the following code shows how to use String.CASE_INSENSITIVE_ORDER field.


/* w  ww .j  a  va  2 s. c o m*/

import java.util.Arrays;

public class Main {
  public static void main(String[] argv) {
    String[] rawStrings = {  "B", "java2s.com", "b","A", "a","c", "C" };
    System.out.println(Arrays.toString(rawStrings));
    Arrays.sort(rawStrings,String.CASE_INSENSITIVE_ORDER);
    System.out.println(Arrays.toString(rawStrings));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable