HTTPClient
Class CIString

java.lang.Object
  |
  +--HTTPClient.CIString

final class CIString
extends java.lang.Object

This class' raison d'etre is that I want to use a Hashtable using Strings as keys and I want the lookup be case insensitive, but I also want to be able retrieve the keys with original case (otherwise I could just use toLowerCase() in the get() and put()). Since the class String is final we create a new class that holds the string and overrides the methods hashCode() and equals().


Constructor Summary
CIString(java.lang.String string)
          the constructor
 
Method Summary
TypeMethod
(package private) static void ()
           
 boolean equals(java.lang.Object obj)
          Uses the case insensitive comparison.
 java.lang.String getString()
          return the original string
 int hashCode()
          the hash code was precomputed
 java.lang.String toString()
          Just return the internal string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CIString

public CIString(java.lang.String string)
the constructor
Method Detail

getString

public final java.lang.String getString()
return the original string

hashCode

public int hashCode()
the hash code was precomputed
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Uses the case insensitive comparison.
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Just return the internal string.
Overrides:
toString in class java.lang.Object

static void ()