public class

ASCIICaseInsensitiveComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ sun.misc.ASCIICaseInsensitiveComparator

Class Overview

Implements a locale and case insensitive comparator suitable for strings that are known to only contain ASCII characters. Some tables internal to the JDK contain only ASCII data and are using the "generalized" java.lang.String case-insensitive comparator which converts each character to both upper and lower case.

Summary

Fields
public static final Comparator<String> CASE_INSENSITIVE_ORDER
Public Constructors
ASCIICaseInsensitiveComparator()
Public Methods
int compare(String s1, String s2)
static int lowerCaseHashCode(String s)
A case insensitive hash code method to go with the case insensitive compare() method.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Fields

public static final Comparator<String> CASE_INSENSITIVE_ORDER

Public Constructors

public ASCIICaseInsensitiveComparator ()

Public Methods

public int compare (String s1, String s2)

public static int lowerCaseHashCode (String s)

A case insensitive hash code method to go with the case insensitive compare() method. Returns a hash code for this ASCII string as if it were lower case. returns same answer as:

s.toLowerCase(Locale.US).hashCode();

but does not allocate memory (it does NOT have the special case Turkish rules).

Parameters
s a String to compute the hashcode on.
Returns
  • a hash code value for this object.