org.webmacro.util
Class StringArray

java.lang.Object
  |
  +--org.webmacro.util.StringArray

public final class StringArray
extends java.lang.Object

This wraps a string array such that it can be used as the index of a hashtable, etc. It is immutable. You can directly access the final array object (a) that it contains.


Field Summary
 java.lang.String[] a
          The value of the string array is available as 'a'.
 
Constructor Summary
StringArray(int size)
          Create an empty StringArray
StringArray(java.lang.String[] array)
          Create a new StringArray
StringArray(java.util.Vector stringVector)
          Create a StringArray from a Vector, if the elements of the vector are not strings you will get a ClassCastException
 
Method Summary
 boolean equals(java.lang.Object o)
          Two arrays are equal if they have the same elements and are the same size.
 int hashCode()
          Two arrays that are equal have the same hashcode
 void intern()
          Intern all the strings in the array (ensuring that they are unique values, and allowng the use of == for comparing them.)
static void main(java.lang.String[] arg)
          Test harness
 java.lang.String toString()
          Return a string representation listing all of the children
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

a

public final java.lang.String[] a
The value of the string array is available as 'a'.
Constructor Detail

StringArray

public StringArray(java.lang.String[] array)
Create a new StringArray

StringArray

public StringArray(int size)
Create an empty StringArray

StringArray

public StringArray(java.util.Vector stringVector)
Create a StringArray from a Vector, if the elements of the vector are not strings you will get a ClassCastException
Method Detail

intern

public final void intern()
Intern all the strings in the array (ensuring that they are unique values, and allowng the use of == for comparing them.)

toString

public final java.lang.String toString()
Return a string representation listing all of the children
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object o)
Two arrays are equal if they have the same elements and are the same size.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Two arrays that are equal have the same hashcode
Overrides:
hashCode in class java.lang.Object

main

public static void main(java.lang.String[] arg)
Test harness