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

    Constructors
    Constructor
    Description
    Constructs a CaseInsensitiveString from the given String.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this CaseInsensitiveString to another object.
    boolean
    equals(Object other)
    Compares this object to another for equality in a case-insensitive manner.
    int
    Returns the hash code for this object, computed in a case-insensitive manner.
    Returns the original String.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CaseInsensitiveString

      public CaseInsensitiveString(String string)
      Constructs a CaseInsensitiveString from the given String.
      Parameters:
      string - the original String
  • Method Details

    • toString

      public String toString()
      Returns the original String.
      Overrides:
      toString in class Object
      Returns:
      the original String
    • hashCode

      public int hashCode()
      Returns the hash code for this object, computed in a case-insensitive manner.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • equals

      public boolean equals(Object other)
      Compares this object to another for equality in a case-insensitive manner.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare to
      Returns:
      true if they are equal ignoring case, false otherwise
    • compareTo

      public int compareTo(Object o)
      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 interface Comparable<Object>
      Parameters:
      o - the object to compare to
      Returns:
      a negative integer, zero, or a positive integer depending on ordering