Package com.cedarsoftware.util
Class CaseInsensitiveMap.CaseInsensitiveString
java.lang.Object
com.cedarsoftware.util.CaseInsensitiveMap.CaseInsensitiveString
- All Implemented Interfaces:
Comparable<Object>
- Enclosing class:
CaseInsensitiveMap<K,
V>
public static final class CaseInsensitiveMap.CaseInsensitiveString
extends Object
implements Comparable<Object>
Wrapper class for String keys to enforce case-insensitive comparison.
Note: Do not use this class directly, as it will eventually be made private.
-
Constructor Summary
ConstructorsConstructorDescriptionCaseInsensitiveString
(String string) Constructs a CaseInsensitiveString from the given String. -
Method Summary
Modifier and TypeMethodDescriptionint
Compares this CaseInsensitiveString to another object.boolean
Compares this object to another for equality in a case-insensitive manner.int
hashCode()
Returns the hash code for this object, computed in a case-insensitive manner.toString()
Returns the original String.
-
Constructor Details
-
CaseInsensitiveString
Constructs a CaseInsensitiveString from the given String.- Parameters:
string
- the original String
-
-
Method Details
-
toString
Returns the original String. -
hashCode
public int hashCode()Returns the hash code for this object, computed in a case-insensitive manner. -
equals
Compares this object to another for equality in a case-insensitive manner. -
compareTo
Compares this CaseInsensitiveString to another object. If the object is a String or CaseInsensitiveString, comparison is case-insensitive. Otherwise, Strings are considered "less" than non-Strings.- Specified by:
compareTo
in interfaceComparable<Object>
- Parameters:
o
- the object to compare to- Returns:
- a negative integer, zero, or a positive integer depending on ordering
-