Bali Share 1.1.18

oracle.bali.share.collection
Class ImmutableArray

java.lang.Object
  |
  +--oracle.bali.share.collection.ImmutableArray

public class ImmutableArray
extends java.lang.Object

ImmutableArray acts as an immutable array of objects. That is to say, that the elements of the Immutable array will always refer to the same set of objects. There is nothing to prevent the state of the objects referred to by the ImmutableArray from changing.

Since:
SHARE 1.0

Constructor Summary
ImmutableArray()
          Creates an zero length ImmutableArray.
ImmutableArray(java.util.Enumeration enumeration)
          Creates an ImmutableArray from an Enumeration of objects.
ImmutableArray(java.lang.Object[] array)
          Creates an ImmutableArray from a standard array of objects.
ImmutableArray(java.util.Vector vector)
          Creates an ImmutableArray from a Vector of objects.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this array for equality.
 java.lang.Object get(int index)
          Retrieves an object from the array.
 int hashCode()
          Returns the hash code value for this array.
 int size()
          Returns the number of elements in the array.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableArray

public ImmutableArray()
Creates an zero length ImmutableArray.

ImmutableArray

public ImmutableArray(java.lang.Object[] array)
Creates an ImmutableArray from a standard array of objects.
Parameters:
array - Array of Objects used to initialize the array.

ImmutableArray

public ImmutableArray(java.util.Vector vector)
Creates an ImmutableArray from a Vector of objects.
Parameters:
array - Vector of objects used to initialize the array.

ImmutableArray

public ImmutableArray(java.util.Enumeration enumeration)
Creates an ImmutableArray from an Enumeration of objects.
Parameters:
enumeration - Enumeration of Objects to initialize the array.
Method Detail

get

public java.lang.Object get(int index)
                     throws java.lang.ArrayIndexOutOfBoundsException
Retrieves an object from the array.
Parameters:
index - Index of the desired element.
Returns:
an Object
Throws:
java.lang.ArrayIndexOutOfBoundsException - If index is out of bounds

size

public int size()
Returns the number of elements in the array.
Returns:
the number of elements in the array.

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this array for equality. Returns true if and only if the specified object is also an ImmutableArray, both have the same size, and all corresponding pairs of elements in the two lists are equal.
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared for equality with this array.
Returns:
true if the specified object is equal to this array.

hashCode

public int hashCode()
Returns the hash code value for this array.
Overrides:
hashCode in class java.lang.Object

Bali Share 1.1.18