com.ibm.dse.applsrv.aa
Class Array

java.lang.Object
  |
  +--com.ibm.dse.applsrv.aa.Array

public class Array
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Generalization of Vector.

See Also:
Serialized Form

Constructor Summary
Array()
          Return an empty array.
Array(boolean firstElement, boolean secondElement, boolean thirdElement, boolean fourthElement, boolean fifthElement)
          Constructs an array with five elements.
Array(boolean expand, java.lang.Object[] list)
          Constructs an array with a java array being its only element or as its all of its elements.
Array(int initialCapacity)
          Constructs an empty array with the specified initial capacity.
Array(int initialCapacity, int capacityIncrement)
          Constructs an empty array with the specified initial capacity and capacity increment.
Array(int firstElement, int secondElement, java.lang.Object thirdElement)
          Constructs an array with three elements.
Array(int firstElement, java.lang.Object secondElement)
          Constructs an array with two elements.
Array(java.lang.Object firstElement)
          Constructs an array with one element.
Array(java.lang.Object firstElement, java.lang.Object secondElement)
          Constructs an array with two elements.
Array(java.lang.Object firstElement, java.lang.Object secondElement, java.lang.Object thirdElement)
          Constructs an array with three elements.
 
Method Summary
 java.lang.Boolean add(boolean b)
          Add a new element to this array.
 java.lang.Character add(char c)
          Add a new element to this array.
 java.lang.Double add(double n)
          Add a new element to this array.
 java.lang.Float add(float n)
          Add a new element to this array.
 java.lang.Integer add(int n)
          Add a new element to this array.
 void add(int first, int second)
          Add two interger elements to this array.
 void add(int first, int second, int third)
          Add three interger elements to this array.
 java.lang.Long add(long n)
          Add a new element to this array.
 void add(java.lang.Object x)
          Add a new element to this array.
 void add(java.lang.Object x, java.lang.Object y)
          Add 2 new elements to this array.
 void add(java.lang.Object x, java.lang.Object y, java.lang.Object z)
          Add 3 new elements to this array.
 java.lang.Short add(short n)
          Add a new element to this array.
 Array addAll(Array v)
          Add each element of array v to this array.
 Array addAll(boolean[] v)
          Add each element of java array v to this array.
 Array addAll(int[] v)
          Add each element of java array v to this array.
 Array addAll(java.lang.Object[] v)
          Add each element of java array v to this array.
 Array addAll(java.util.Vector v)
          Add each element of vector v to this array.
 Array addAllKeys(Dictionary d)
          Add each key of dictionary d to this array.
 Array addAllKeys(java.util.Hashtable d)
          Add each key of dictionary d to this array.
 void addElement(java.lang.Object anObject)
          Adds the specified element to the end of this array, increasing its size by one.
 boolean addNew(java.lang.Object anObject)
          Add anObject to this array if its not already included.
 java.lang.String[] asArray()
          Return an array of strings corresponding to this Array of strings.
 java.lang.String asList()
          Returns a string representation of this array.
static java.lang.String asList(Array v)
          Return the string representation of the specified list.
 void asList(java.lang.StringBuffer stringBuffer)
          Append the string representation of this array to the string buffer.
 java.lang.Object[] asObjectArray()
          Return an array of objects corresponding to this Array of objects.
static java.lang.String asString(Array v)
          Return the string representation of the specified vector.
static java.lang.String asString(java.util.Vector v)
          Return the string representation of the specified vector.
 java.util.Vector asVector()
          Return a Vector corresponding to this Array.
 java.lang.Object at(int index)
          Return the n'th element of this array or null if out of range.
 java.lang.Object basicAt(int index)
          Return the n'th element of this array.
 int capacity()
          Returns the current capacity of this array.
 Array cat(Array v)
          Return the concatenation of the receiver with the specified array.
 Array cat(java.util.Vector v)
          Return the concatenation of the receiver with the specified vector.
 void clear()
          Set the effective size of this array to 0.
 java.lang.Object clone()
          Returns a clone of this array.
 boolean contains(java.lang.Object anObject)
          Tests if the specified object is an element of this array.
 Array copy()
          Return a copy of this array.
static Array copy(Array anArray)
          Return a copy of the specified array or null if the argument is null.
 void copyInto(java.lang.Object[] anArray)
          Copies the elements of this vector into the specified array.
 java.lang.Object elementAt(int index)
          Returns the element at the specified index.
 java.util.Enumeration elements()
          Returns an enumeration of the elements of this array.
 boolean empty()
          Return true if this array is empty else return false.
 void ensureCapacity(int minCapacity)
          Increases the capacity of this array, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
 java.util.Enumeration enum()
          Return an enumeration constructed from this array.
 boolean excludes(java.lang.Object anObject)
          Return true if this array does not contain the specified object.
 java.lang.Object fifth()
          Return the fifth element of this array or null if there is no fifth element.
 java.lang.Object first()
          Return the first element of this array or null if this array is empty.
 java.lang.Object firstElement()
          Returns the first element of this array.
 java.lang.Object fourth()
          Return the fourth element of this array or null if there is no fourth element.
static Array from(boolean[] v)
          Return an Array constructed from a java array.
static Array from(int[] v)
          Return an Array constructed from a java array.
static Array from(java.lang.Object[] v)
          Return an Array constructed from a java array.
static Array from(java.lang.String s)
          Return an Array constructed from the words found within the specified string.
static Array from(java.lang.String s, char c)
          Return an Array constructed from the words found within the specified string.
static Array from(java.util.Vector v)
          Return an Array constructed from a vector.
static Array fromKeys(Dictionary d)
          Return an Array constructed from the keys of a dictionary.
static Array fromKeys(java.util.Hashtable d)
          Return an Array constructed from the keys of a dictionary.
 boolean includes(java.lang.Object anObject)
          Return true if this array contains the specified object.
 int includesAll(java.lang.Object[] list)
          Return the index of the first element of list not found in this array or -1 if all found.
 int includesAny(java.lang.Object[] list)
          Return the index of the first element of list found in this array or -1 if none found.
 boolean includesIdentical(java.lang.Object anObject)
          Return true if this array contains the specified object via identity.
 int indexOf(java.lang.Object elem)
          Searches for the first occurence of the given argument, testing for equality using the equals method.
 int indexOf(java.lang.Object elem, int index)
          Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
 void insertElementAt(java.lang.Object obj, int index)
          Inserts the specified object as an element in this array at the specified index.
 boolean isEmpty()
          Tests if this array has no elements.
 java.lang.Object last()
          Return the last element of this array or null if this array is empty.
 java.lang.Object lastElement()
          Returns the last element of the array.
 int lastIndexOf(java.lang.Object elem)
          Returns the index of the last occurrence of the specified object in this array.
 int lastIndexOf(java.lang.Object elem, int index)
          Searches backwards for the specified object, starting from the specified index, and returns an index to it.
static java.lang.String[] parse(char[] s)
          Return a string array constructed from the words found within the specified character array.
 Array prefix(java.lang.String s)
          Return a new Array which contains the elements of the current Array each prefixed by String s.
 boolean put(int n, java.lang.Object x)
          Place object x into the n'th position (0-indexed) of this array.
 boolean remove(java.lang.Object obj)
          Remove an element of this array.
 int removeAll(java.lang.Object[] list)
          Remove all the elements in list from this array.
 void removeAllElements()
          Removes all elements from this array and sets its size to zero.
 boolean removeElement(java.lang.Object obj)
          Removes the first occurrence of the argument from this array.
 void removeElementAt(int index)
          Deletes the element at the specified index.
 Array rpadv(int n, java.lang.Object x)
          Return this array right padded to the specified size with the specified object.
 java.lang.Object second()
          Return the second element of this array or null if there is no second element.
 void set(Array list)
          Set the elements of this array to the specified list.
 void set(java.lang.Object[] elements)
          Set the elements of this array to the specified list.
 void set(java.lang.Object element1, java.lang.Object element2)
          Set the elements of this array to the specified values.
 void set(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3)
          Set the elements of this array to the specified values.
 void set(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3, java.lang.Object element4)
          Set the elements of this array to the specified values.
 void set(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3, java.lang.Object element4, java.lang.Object element5)
          Set the elements of this array to the specified values.
 void set(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3, java.lang.Object element4, java.lang.Object element5, java.lang.Object element6)
          Set the elements of this array to the specified values.
 void setElementAt(java.lang.Object obj, int index)
          Sets the element at the specified index of this array to be the specified object.
 void setSize(int newSize)
          Sets the size of this array.
 void setTo(java.lang.Object element1)
          Set the elements of this array to the specified value.
 int size()
          Returns the number of elements in this array.
 Array sort()
          Sort this array of Strings (no other element types must be present).
static java.lang.String[] sort(java.lang.String[] v)
          Return the argument as a sorted java string array.
 Array suffix(java.lang.String s)
          Return a new Array which contains the elements of the current Array each suffixed by String s.
 Array surround(java.lang.String s)
          Return a new Array which contains the elements of the current Array each prefixed and suffixed by String s.
 Array surround(java.lang.String s, java.lang.String t)
          Return a new Array which contains the elements of the current Array each prefixed by String s and suffixed by String t.
 void swap(int i, int j)
          Swap the elements at the 2 indexes.
 java.lang.Object third()
          Return the third element of this array or null if there is no third element.
 java.lang.String toString()
          Returns a string representation of this array.
 void toString(java.lang.StringBuffer stringBuffer)
          Append the string representation of this array to the string buffer.
 void trimToSize()
          Trims the capacity of this array to be the array's current size.
static Array with()
          Return an empty array.
static Array with(java.lang.Object x)
          Return a 1 element array.
static Array with(java.lang.Object x, java.lang.Object y)
          Return a 2 element array.
static Array with(java.lang.Object x, java.lang.Object y, java.lang.Object z)
          Return a 3 element array.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Array

public Array()
Return an empty array.

Array

public Array(int initialCapacity)
Constructs an empty array with the specified initial capacity.
Parameters:
initialCapacity - int - the initial capacity of the array.

Array

public Array(int initialCapacity,
             int capacityIncrement)
Constructs an empty array with the specified initial capacity and capacity increment.
Parameters:
initialCapacity - int - the initial capacity of the array.
capacityIncrement - int - the amount by which the capacity is increased when the array overflows.

Array

public Array(int firstElement,
             int secondElement,
             java.lang.Object thirdElement)
Constructs an array with three elements.
Parameters:
firstElement - int - the first element of the array.
secondElement - int - the second element of the array.
thirdElement - Object - the third element of the array.

Array

public Array(int firstElement,
             java.lang.Object secondElement)
Constructs an array with two elements.
Parameters:
firstElement - int - the first element of the array.
secondElement - Object - the second element of the array.

Array

public Array(java.lang.Object firstElement)
Constructs an array with one element.
Parameters:
firstElement - Object - the first element of the array.

Array

public Array(java.lang.Object firstElement,
             java.lang.Object secondElement)
Constructs an array with two elements.
Parameters:
firstElement - Object - the first element of the array.
secondElement - Object - the second element of the array.

Array

public Array(java.lang.Object firstElement,
             java.lang.Object secondElement,
             java.lang.Object thirdElement)
Constructs an array with three elements.
Parameters:
firstElement - Object - the first element of the array.
secondElement - Object - the second element of the array.
thirdElement - Object - the third element of the array.

Array

public Array(boolean expand,
             java.lang.Object[] list)
Constructs an array with a java array being its only element or as its all of its elements.
Parameters:
expand - boolean - if true then each element of 'list' becomes an element of this array else the list itself becomes the sole element of this array.
list - Object[] - the list to include (one way or another).

Array

public Array(boolean firstElement,
             boolean secondElement,
             boolean thirdElement,
             boolean fourthElement,
             boolean fifthElement)
Constructs an array with five elements.
Parameters:
firstElement - boolean - the first element of the array.
secondElement - boolean - the second element of the array.
thirdElement - boolean - the third element of the array.
fourthElement - boolean - the fourth element of the array.
fifthElement - boolean - the fifth element of the array.
Method Detail

add

public java.lang.Character add(char c)
Add a new element to this array.
Parameters:
c - char - the element to add.
Returns:
Character - return the added element as a Java object.

add

public java.lang.Double add(double n)
Add a new element to this array.
Parameters:
n - double - the element to add.
Returns:
Double - return the added element as a Java object.

add

public java.lang.Float add(float n)
Add a new element to this array.
Parameters:
n - float - the element to add.
Returns:
Float - return the added element as a Java object.

add

public java.lang.Integer add(int n)
Add a new element to this array.
Parameters:
n - int - the element to add.
Returns:
Integer - return the added element as a Java object.

add

public void add(int first,
                int second)
Add two interger elements to this array.
Parameters:
first - int - the first element to add.
second - int - the second element to add.

add

public void add(int first,
                int second,
                int third)
Add three interger elements to this array.
Parameters:
first - int - the first element to add.
second - int - the second element to add.
third - int - the third element to add.

add

public java.lang.Long add(long n)
Add a new element to this array.
Parameters:
n - long - the element to add.
Returns:
Long - return the added element as a Java object.

add

public void add(java.lang.Object x)
Add a new element to this array.
Parameters:
x - Object - the element to add.

add

public void add(java.lang.Object x,
                java.lang.Object y)
Add 2 new elements to this array.
Parameters:
x - Object - the first element to add.
y - Object - the second element to add.

add

public void add(java.lang.Object x,
                java.lang.Object y,
                java.lang.Object z)
Add 3 new elements to this array.
Parameters:
x - Object - the first element to add.
y - Object - the second element to add.
z - Object - the third element to add.

add

public java.lang.Short add(short n)
Add a new element to this array.
Parameters:
n - short - the element to add.
Returns:
Short - return the added element as a Java object.

add

public java.lang.Boolean add(boolean b)
Add a new element to this array.
Parameters:
b - boolean - the element to add.
Returns:
Boolean - return the added element as a Java object.

addAll

public Array addAll(int[] v)
Add each element of java array v to this array.
Parameters:
v - int[] - the objects to be added.
Returns:
Array - the resulting array.

addAll

public Array addAll(java.lang.Object[] v)
Add each element of java array v to this array.
Parameters:
v - Object[] - the objects to be added.
Returns:
Array - the resulting array.

addAll

public Array addAll(boolean[] v)
Add each element of java array v to this array.
Parameters:
v - boolean[] - the objects to be added.
Returns:
Array - the resulting array.

addAll

public Array addAll(Array v)
Add each element of array v to this array.
Parameters:
v - Array - the objects to be added.
Returns:
Array - the resulting array.

addAll

public Array addAll(java.util.Vector v)
Add each element of vector v to this array.
Parameters:
v - Vector - the objects to be added.
Returns:
Array - the resulting array.

addAllKeys

public Array addAllKeys(Dictionary d)
Add each key of dictionary d to this array.
Parameters:
d - Dictionary - the dictionary who's keys are to be added.
Returns:
Array - the resulting array.

addAllKeys

public Array addAllKeys(java.util.Hashtable d)
Add each key of dictionary d to this array.
Parameters:
d - Hashtable - the dictionary who's keys are to be added.
Returns:
Array - the resulting array.

addElement

public void addElement(java.lang.Object anObject)
Adds the specified element to the end of this array, increasing its size by one. The capacity of this array is increased if its size becomes greater than its capacity.
Parameters:
anObject - Object - the element to be added.

addNew

public boolean addNew(java.lang.Object anObject)
Add anObject to this array if its not already included.
Parameters:
anObject - Object - the object to be added.
Returns:
boolean - true if the object was added else false.
Throws:
NullPointerException - - if the argument is null.

asArray

public java.lang.String[] asArray()
Return an array of strings corresponding to this Array of strings.
Returns:
String[] - the array of strings.

asList

public java.lang.String asList()
Returns a string representation of this array. The elements are separated by single spaces.
Returns:
String - a string representation of this array.

asList

public static java.lang.String asList(Array v)
Return the string representation of the specified list.
Parameters:
v - Array - the array.
Returns:
String - the string representation of the specified vector.

asList

public void asList(java.lang.StringBuffer stringBuffer)
Append the string representation of this array to the string buffer.
Parameters:
stringBuffer - StringBuffer - the string buffer to append to.
Throws:
NullPointerException - - if stringBuffer == null.

asObjectArray

public java.lang.Object[] asObjectArray()
Return an array of objects corresponding to this Array of objects.
Returns:
Object[] - the array of objects.

asString

public static java.lang.String asString(Array v)
Return the string representation of the specified vector.
Parameters:
v - Array - the array.
Returns:
String - the string representation of the specified vector.

asString

public static java.lang.String asString(java.util.Vector v)
Return the string representation of the specified vector.
Parameters:
v - Vector - the vector.
Returns:
String - the string representation of the specified vector.

asVector

public java.util.Vector asVector()
Return a Vector corresponding to this Array.
Returns:
Vector - the corresponding vector.

at

public java.lang.Object at(int index)
Return the n'th element of this array or null if out of range. 0-indexed.
Parameters:
index - int - the index of the element.
Returns:
Object - the element.

basicAt

public java.lang.Object basicAt(int index)
Return the n'th element of this array. Raise an exception if the index is out of range.
Parameters:
index - int - the index of the element.
Returns:
Object - the element.

capacity

public int capacity()
Returns the current capacity of this array.
Returns:
int - the current capacity of this array.

cat

public Array cat(Array v)
Return the concatenation of the receiver with the specified array.
Parameters:
v - Array - the array.
Returns:
Array - the concatenated array.

cat

public Array cat(java.util.Vector v)
Return the concatenation of the receiver with the specified vector.
Parameters:
v - Vector - the vector.
Returns:
Array - the concatenated array.

clear

public void clear()
Set the effective size of this array to 0.

clone

public java.lang.Object clone()
Returns a clone of this array.
Overrides:
clone in class java.lang.Object
Returns:
Object - a clone of this Array.

contains

public boolean contains(java.lang.Object anObject)
Tests if the specified object is an element of this array.
Parameters:
anObject - Object - the object to check for.
Returns:
boolean - true if the specified object is an element of this array, false otherwise.
Throws:
NullPointerException - - if the argument is null.

copy

public Array copy()
Return a copy of this array.
Returns:
Array - the copy.

copy

public static Array copy(Array anArray)
Return a copy of the specified array or null if the argument is null.
Parameters:
anArray - Array - the array to copy (or null).
Returns:
Array - the copy of the array (or null).

copyInto

public void copyInto(java.lang.Object[] anArray)
Copies the elements of this vector into the specified array. The array must be large enough to hold all the elements in this array.
Parameters:
anArray - Object[] - the array into which the elements get copied.

elementAt

public java.lang.Object elementAt(int index)
Returns the element at the specified index.
Parameters:
index - int - the index of the element.
Returns:
Object - the element.
Throws:
ArrayIndexOutOfBoundsException - - if an invalid index was given.

elements

public java.util.Enumeration elements()
Returns an enumeration of the elements of this array.
Returns:
Enumeration - an enumeration of the elements of this array.

empty

public boolean empty()
Return true if this array is empty else return false.
Returns:
boolean - the empty status.

ensureCapacity

public void ensureCapacity(int minCapacity)
Increases the capacity of this array, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
Parameters:
minCapacity - int - the desired minimum capacity.

enum

public java.util.Enumeration enum()
Return an enumeration constructed from this array.
Returns:
Enumeration - the enumeration.

excludes

public boolean excludes(java.lang.Object anObject)
Return true if this array does not contain the specified object.
Parameters:
anObject - Object - the candidate element.
Returns:
boolean - the exclusion status.
Throws:
NullPointerException - - if the argument is null.

fifth

public java.lang.Object fifth()
Return the fifth element of this array or null if there is no fifth element.
Returns:
Object - the fifth element.

first

public java.lang.Object first()
Return the first element of this array or null if this array is empty.
Returns:
Object - the first element.

firstElement

public java.lang.Object firstElement()
Returns the first element of this array.
Returns:
Object - the first element.
Throws:
java.util.NoSuchElementException - - if this array is empty.

fourth

public java.lang.Object fourth()
Return the fourth element of this array or null if there is no fourth element.
Returns:
Object - the fourth element.

from

public static Array from(int[] v)
Return an Array constructed from a java array.
Parameters:
v - int[] - the java array.
Returns:
Array - the constructed array.

from

public static Array from(java.lang.Object[] v)
Return an Array constructed from a java array.
Parameters:
v - Object[] - the java array.
Returns:
Array - the constructed array.

from

public static Array from(boolean[] v)
Return an Array constructed from a java array.
Parameters:
v - boolean[] - the java array.
Returns:
Array - the constructed array.

from

public static Array from(java.lang.String s)
Return an Array constructed from the words found within the specified string.
Parameters:
s - String - the string to parse.
Returns:
Array - the constructed array.

from

public static Array from(java.lang.String s,
                         char c)
Return an Array constructed from the words found within the specified string.
Parameters:
s - String - the string to parse.
c - char - the delimiter.
Returns:
Array - the constructed array.

from

public static Array from(java.util.Vector v)
Return an Array constructed from a vector.
Parameters:
v - Vector - the vector.
Returns:
Array - the constructed array.

fromKeys

public static Array fromKeys(Dictionary d)
Return an Array constructed from the keys of a dictionary.
Parameters:
d - Dictionary - the dictionary who's keys are to be added.
Returns:
Array - the constructed array.

fromKeys

public static Array fromKeys(java.util.Hashtable d)
Return an Array constructed from the keys of a dictionary.
Parameters:
d - Hashtable - the dictionary who's keys are to be added.
Returns:
Array - the constructed array.

includes

public boolean includes(java.lang.Object anObject)
Return true if this array contains the specified object.
Parameters:
anObject - Object - the candidate element.
Returns:
boolean - the inclusion status.
Throws:
NullPointerException - - if the argument is null.

includesAll

public int includesAll(java.lang.Object[] list)
Return the index of the first element of list not found in this array or -1 if all found.
Parameters:
list - Object[] - the list of elements to check.
Returns:
int - index of list element not found in this array or -1.
Throws:
NullPointerException - - if the argument or any element is null.

includesAny

public int includesAny(java.lang.Object[] list)
Return the index of the first element of list found in this array or -1 if none found.
Parameters:
list - Object[] - the list of elements to check.
Returns:
int - index of list element found in this array or -1.
Throws:
NullPointerException - - if the argument or any element is null.

includesIdentical

public boolean includesIdentical(java.lang.Object anObject)
Return true if this array contains the specified object via identity.
Parameters:
anObject - Object - the candidate element.
Returns:
boolean - the inclusion status.

indexOf

public int indexOf(java.lang.Object elem)
Searches for the first occurence of the given argument, testing for equality using the equals method.
Parameters:
elem - Object - the candidate element.
Returns:
int - the index of the first occurrence of the argument in this array, returns -1 if the object is not found.
Throws:
NullPointerException - - if the argument is null.
See Also:
Object.equals(Object).

indexOf

public int indexOf(java.lang.Object elem,
                   int index)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
Parameters:
elem - Object - the candidate element.
index - int - the index to start searching from.
Returns:
int - the index of the first occurrence of the object argument in this array at position index or later, returns -1 if the object is not found.
Throws:
NullPointerException - - if the argument is null.
See Also:
Object.equals(java.lang.Object).

insertElementAt

public void insertElementAt(java.lang.Object obj,
                            int index)
Inserts the specified object as an element in this array at the specified index. Each element of this array with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

The index must be a value greater than or equal to 0 and less than or equal to the current size of the array.

Parameters:
obj - Object - the element to insert.
index - int - where to insert the new element.
Throws:
ArrayIndexOutOfBoundsException - - if the index was invalid.
See Also:
size().

isEmpty

public boolean isEmpty()
Tests if this array has no elements.
Returns:
boolean - true if this array has no elements, false otherwise.

last

public java.lang.Object last()
Return the last element of this array or null if this array is empty.
Returns:
Object - the last element.

lastElement

public java.lang.Object lastElement()
Returns the last element of the array.
Returns:
Object - the last element.
Throws:
java.util.NoSuchElementException - - if this array is empty.

lastIndexOf

public int lastIndexOf(java.lang.Object elem)
Returns the index of the last occurrence of the specified object in this array.
Parameters:
elem - Object - the candidate element.
Returns:
int - the index of the last occurrence of the argument in this array, returns -1 if the object is not found.
Throws:
NullPointerException - - if the argument is null.

lastIndexOf

public int lastIndexOf(java.lang.Object elem,
                       int index)
Searches backwards for the specified object, starting from the specified index, and returns an index to it.
Parameters:
elem - Object - the candidate element.
index - int - the index to start searching from.
Returns:
int - the index of the last occurrence of the argument in this array, returns -1 if the object is not found.
Throws:
NullPointerException - - if the argument is null.

parse

public static java.lang.String[] parse(char[] s)
Return a string array constructed from the words found within the specified character array.
Parameters:
s - char[] - the 'string' to parse.
Returns:
String[] - the constructed array.

prefix

public Array prefix(java.lang.String s)
Return a new Array which contains the elements of the current Array each prefixed by String s.
Parameters:
s - String - the prefix.
Returns:
Array - the resulting array.

put

public boolean put(int n,
                   java.lang.Object x)
Place object x into the n'th position (0-indexed) of this array.
Parameters:
n - int - the index of the element.
x - Object - the object to add.
Returns:
boolean - return true if the put was successful else return false.

remove

public boolean remove(java.lang.Object obj)
Remove an element of this array.
Parameters:
obj - Object - the element to remove.
Returns:
boolean - true if an element was deleted else false.
Throws:
NullPointerException - - if the argument is null.

removeAll

public int removeAll(java.lang.Object[] list)
Remove all the elements in list from this array.
Parameters:
list - Object[] - the elements to remove.
Returns:
int - the index of the last element in list that was not found in this array or -1 otherwise.
Throws:
NullPointerException - - if the argument or any of its elements is null.

removeAllElements

public void removeAllElements()
Removes all elements from this array and sets its size to zero.

removeElement

public boolean removeElement(java.lang.Object obj)
Removes the first occurrence of the argument from this array. If the object is found in this array, each element in the array with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.
Parameters:
obj - Object - the element to remove.
Returns:
boolean - true if an element was deleted else false.
Throws:
NullPointerException - - if the argument is null.

removeElementAt

public void removeElementAt(int index)
Deletes the element at the specified index. Each element in this array with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously.

The index must be a value greater than or equal to 0 and less than the current size of the array.

Parameters:
index - int - the index of the object to remove.
Throws:
ArrayIndexOutOfBoundsException - - if the index was invalid.
See Also:
size().

rpadv

public Array rpadv(int n,
                   java.lang.Object x)
Return this array right padded to the specified size with the specified object. No truncation.
Parameters:
n - int - the minimum size of the result vector.
x - Object - the padding object.
Returns:
Array - this array after padding.

second

public java.lang.Object second()
Return the second element of this array or null if there is no second element.
Returns:
Object - the second element.

set

public void set(java.lang.Object[] elements)
Set the elements of this array to the specified list.
Parameters:
elements - Object[] - the new list of elements.
Throws:
NullPointerException - - if the argument is null.

set

public void set(Array list)
Set the elements of this array to the specified list.
Parameters:
list - Array - the new list of elements.
Throws:
NullPointerException - - if the argument is null.

set

public void set(java.lang.Object element1,
                java.lang.Object element2)
Set the elements of this array to the specified values.
Parameters:
element1 - Object - the first element.
element2 - Object - the second element.

set

public void set(java.lang.Object element1,
                java.lang.Object element2,
                java.lang.Object element3)
Set the elements of this array to the specified values.
Parameters:
element1 - Object - the first element.
element2 - Object - the second element.
element3 - Object - the third element.

set

public void set(java.lang.Object element1,
                java.lang.Object element2,
                java.lang.Object element3,
                java.lang.Object element4)
Set the elements of this array to the specified values.
Parameters:
element1 - Object - the first element.
element2 - Object - the second element.
element3 - Object - the third element.
element4 - Object - the fourth element.

set

public void set(java.lang.Object element1,
                java.lang.Object element2,
                java.lang.Object element3,
                java.lang.Object element4,
                java.lang.Object element5)
Set the elements of this array to the specified values.
Parameters:
element1 - Object - the first element.
element2 - Object - the second element.
element3 - Object - the third element.
element4 - Object - the fourth element.
element5 - Object - the fifth element.

set

public void set(java.lang.Object element1,
                java.lang.Object element2,
                java.lang.Object element3,
                java.lang.Object element4,
                java.lang.Object element5,
                java.lang.Object element6)
Set the elements of this array to the specified values.
Parameters:
element1 - Object - the first element.
element2 - Object - the second element.
element3 - Object - the third element.
element4 - Object - the fourth element.
element5 - Object - the fifth element.
element6 - Object - the sixth element.

setElementAt

public void setElementAt(java.lang.Object obj,
                         int index)
Sets the element at the specified index of this array to be the specified object. The previous element at that position is discarded.

The index must be a value greater than or equal to 0 and less than the current size of the array.

Parameters:
obj - Object - the replacement element.
index - int - the specified index.
Throws:
ArrayIndexOutOfBoundsException - - if the index was invalid.
See Also:
size().

setSize

public void setSize(int newSize)
Sets the size of this array. If the new size is greater than the current size, new null items are added to the end of the array. If the new size is less than the current size, all components at index newSize and greater are discarded.
Parameters:
newSize - int - the new size of this array.

setTo

public void setTo(java.lang.Object element1)
Set the elements of this array to the specified value.
Parameters:
element1 - Object - the first element.

size

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

sort

public Array sort()
Sort this array of Strings (no other element types must be present).
Returns:
Array - this array after sorting.

sort

public static java.lang.String[] sort(java.lang.String[] v)
Return the argument as a sorted java string array.
Parameters:
v - String[] - the java string array to sort.
Returns:
String[] - the sorted array.

suffix

public Array suffix(java.lang.String s)
Return a new Array which contains the elements of the current Array each suffixed by String s.
Parameters:
s - String - the suffix.
Returns:
Array - the resulting array.

surround

public Array surround(java.lang.String s)
Return a new Array which contains the elements of the current Array each prefixed and suffixed by String s.
Parameters:
s - String - the prefix and suffix.
Returns:
Array - the resulting array.

surround

public Array surround(java.lang.String s,
                      java.lang.String t)
Return a new Array which contains the elements of the current Array each prefixed by String s and suffixed by String t.
Parameters:
s - String - the prefix.
t - String - the suffix.
Returns:
Array - the resulting array.

swap

public void swap(int i,
                 int j)
Swap the elements at the 2 indexes.
Parameters:
i - int - the index of the first element.
j - int - the index of the second element.

third

public java.lang.Object third()
Return the third element of this array or null if there is no third element.
Returns:
Object - the third element.

toString

public java.lang.String toString()
Returns a string representation of this array.
Overrides:
toString in class java.lang.Object
Returns:
String - a string representation of this array.

toString

public void toString(java.lang.StringBuffer stringBuffer)
Append the string representation of this array to the string buffer.
Parameters:
stringBuffer - StringBuffer - the string buffer to append to.
Throws:
NullPointerException - - if stringBuffer == null.

trimToSize

public void trimToSize()
Trims the capacity of this array to be the array's current size. An application can use this operation to minimize the storage of a array.

with

public static Array with()
Return an empty array.
Returns:
Array - the array.

with

public static Array with(java.lang.Object x)
Return a 1 element array.
Parameters:
x - Object - the first element.
Returns:
Array - the array.

with

public static Array with(java.lang.Object x,
                         java.lang.Object y)
Return a 2 element array.
Parameters:
x - Object - the first element.
y - Object - the second element.
Returns:
Array - the array.

with

public static Array with(java.lang.Object x,
                         java.lang.Object y,
                         java.lang.Object z)
Return a 3 element array.
Parameters:
x - Object - the first element.
y - Object - the second element.
z - Object - the third element.
Returns:
Array - the array.