Class CaseInsensitiveString


  • public class CaseInsensitiveString
    extends java.lang.Object
    A string used as a key in java.util.Hashtable and other collections. It retains case information, but its equals() and hashCode() methods ignore case.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String folded  
      private int hash  
      private java.lang.String string  
    • Constructor Summary

      Constructors 
      Constructor Description
      CaseInsensitiveString​(java.lang.String s)
      Constructs an CaseInsentiveString object from the given string
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Compare the object with this
      private static java.lang.String foldCase​(java.lang.String foldee)  
      private void getFolded()  
      java.lang.String getString()
      returns the underlying string
      int hashCode()
      Returns the hashCode of this object
      java.lang.String toString()
      Overrides superclass method
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • string

        private java.lang.String string
      • hash

        private int hash
      • folded

        private java.lang.String folded
    • Constructor Detail

      • CaseInsensitiveString

        public CaseInsensitiveString​(java.lang.String s)
        Constructs an CaseInsentiveString object from the given string
        Parameters:
        s - The string to construct this object from
    • Method Detail

      • foldCase

        private static java.lang.String foldCase​(java.lang.String foldee)
      • getFolded

        private void getFolded()
      • getString

        public java.lang.String getString()
        returns the underlying string
        Returns:
        String
      • equals

        public boolean equals​(java.lang.Object o)
        Compare the object with this
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - Object to compare this object with
      • hashCode

        public int hashCode()
        Returns the hashCode of this object
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        int hashcode
      • toString

        public java.lang.String toString()
        Overrides superclass method
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the object.