All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.util.VArray

java.lang.Object
   |
   +----jp.kyasu.util.VArray

public class VArray
extends Object
implements Cloneable, Serializable
The VArray class implements a variable length (growable) array of objects and primitive types. Like an array, it contains components that can be accessed using an integer index. However, the size of a VArray can grow or shrink as needed to accommodate adding and removing items after the VArray has been created.

A VArray is constructed with the specified component type. For example:

 VArray varray1 = new VArray(Object.class);
 VArray varray2 = new VArray(String.class);
 VArray varray3 = new VArray(int.class);
 
The VArray has many useful operations. For example:
     VArray varray1 = new VArray(int.class);
     varray1.append(1).append(2).append(3);
         // { 1, 2, 3 }
     VArray varray2 = (VArray)varray1.clone();
     varray1.append(varray2);
         // { 1, 2, 3, 1, 2, 3 }
     varray1.insert(0, varray2);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.insert(varray1.length(), varray2);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.insert(3, varray2);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.remove(0, 3);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.remove(3, 3);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.replace(0, 0, varray2);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.replace(varray1.length(), varray1.length(), varray2);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.replace(3, 12, varray2);
         // { 1, 2, 3, 1, 2, 3, 1, 2, 3 }
     varray1.sort();
         // { 1, 1, 1, 2, 2, 2, 3, 3, 3 }
 

Version:
24 Jun 1998
Author:
Kazuki YASUMATSU

Constructor Index

 o VArray(Class)
Constructs an empty array with the specified component type.
 o VArray(Class, int)
Constructs an empty array with the specified component type and initial capacity.
 o VArray(Class, int, int)
Constructs an empty array with the specified component type, initial capacity, and the maximum capacity increment size.
 o VArray(Object)
Constructs an array with the specified array buffer.
 o VArray(Object, int)
Constructs an array with the specified array buffer and the maximum capacity increment size.
 o VArray(String)
Constructs an array with the contents of the string.
 o VArray(String, int)
Constructs an array with the contents of the string and the maximum capacity increment size.

Method Index

 o append(boolean)
Appends the boolean value to this array.
 o append(byte)
Appends the byte value to this array.
 o append(char)
Appends the char value to this array.
 o append(char[])
Appends the characters of the array object to this array.
 o append(char[], int, int)
Appends the characters of the array object to this array.
 o append(double)
Appends the double value to this array.
 o append(float)
Appends the float value to this array.
 o append(int)
Appends the int value to this array.
 o append(long)
Appends the long value to this array.
 o append(Object)
Appends the object to this array.
 o append(short)
Appends the short value to this array.
 o append(String)
Appends the characters of the string to this array.
 o append(String, int, int)
Appends the characters of the string from the specified begin index to the specified endIndex-1 index.
 o append(VArray)
Appends the components of the VArray object to this array.
 o append(VArray, int, int)
Appends the components of the VArray object to this array.
 o clone()
Returns a clone of this array.
 o elements()
Returns an enumeration of the components of this array.
 o equals(Object)
Compares two Objects for equality.
 o get(int)
Returns the component at the specified index, as an object.
 o getArray()
Returns the buffer of this array.
 o getBoolean(int)
Returns the component at the specified index, as a boolean.
 o getByte(int)
Returns the component at the specified index, as a byte.
 o getChar(int)
Returns the component at the specified index, as a char.
 o getComponentType()
Returns the component type of this array.
 o getDouble(int)
Returns the component at the specified index, as a double.
 o getFloat(int)
Returns the component at the specified index, as a float.
 o getInt(int)
Returns the component at the specified index, as an int.
 o getLength()
Returns the length of this array, i.e., the number of components in this array.
 o getLong(int)
Returns the component at the specified index, as a long.
 o getShort(int)
Returns the component at the specified index, as a short.
 o getSize()
Returns the size of this array, i.e., the number of components in this array.
 o getTrimmedArray()
Returns an array object whoes length is trimmed to be this array's current length.
 o hashCode()
Returns a hashcode for this array.
 o indexOf(boolean)
Searches for the first occurence of the specified boolean value.
 o indexOf(boolean, int)
Searches for the first occurence of the specified boolean value, beginning the search at fromIndex.
 o indexOf(byte)
Searches for the first occurence of the specified byte value.
 o indexOf(byte, int)
Searches for the first occurence of the specified byte value, beginning the search at fromIndex.
 o indexOf(char)
Searches for the first occurence of the specified char value.
 o indexOf(char, int)
Searches for the first occurence of the specified char value, beginning the search at fromIndex.
 o indexOf(double)
Searches for the first occurence of the specified double value.
 o indexOf(double, int)
Searches for the first occurence of the specified double value, beginning the search at fromIndex.
 o indexOf(float)
Searches for the first occurence of the specified float value.
 o indexOf(float, int)
Searches for the first occurence of the specified float value, beginning the search at fromIndex.
 o indexOf(int)
Searches for the first occurence of the specified int value.
 o indexOf(int, int)
Searches for the first occurence of the specified int value, beginning the search at fromIndex.
 o indexOf(long)
Searches for the first occurence of the specified long value.
 o indexOf(long, int)
Searches for the first occurence of the specified long value, beginning the search at fromIndex.
 o indexOf(Object)
Searches for the first occurence of the specified object, testing for equality using the equals method.
 o indexOf(Object, int)
Searches for the first occurence of the specified object, beginning the search at fromIndex, and testing for equality using the equals method.
 o indexOf(short)
Searches for the first occurence of the specified short value.
 o indexOf(short, int)
Searches for the first occurence of the specified short value, beginning the search at fromIndex.
 o insert(int, VArray)
Inserts the components of the VArray object to this array from the specified offset.
 o insert(int, VArray, int, int)
Inserts the components of the VArray object to this array from the specified offset.
 o isEmpty()
Tests if this array has no components.
 o lastIndexOf(boolean)
Searches backwards for the last occurence of the specified boolean value.
 o lastIndexOf(boolean, int)
Searches backwards for the last occurence of the specified boolean value, beginning the search at fromIndex.
 o lastIndexOf(byte)
Searches backwards for the last occurence of the specified byte value.
 o lastIndexOf(byte, int)
Searches backwards for the last occurence of the specified byte value, beginning the search at fromIndex.
 o lastIndexOf(char)
Searches backwards for the last occurence of the specified char value.
 o lastIndexOf(char, int)
Searches backwards for the last occurence of the specified char value, beginning the search at fromIndex.
 o lastIndexOf(double)
Searches backwards for the last occurence of the specified double value.
 o lastIndexOf(double, int)
Searches backwards for the last occurence of the specified double value, beginning the search at fromIndex.
 o lastIndexOf(float)
Searches backwards for the last occurence of the specified float value.
 o lastIndexOf(float, int)
Searches backwards for the last occurence of the specified float value, beginning the search at fromIndex.
 o lastIndexOf(int)
Searches backwards for the last occurence of the specified int value.
 o lastIndexOf(int, int)
Searches backwards for the last occurence of the specified int value, beginning the search at fromIndex.
 o lastIndexOf(long)
Searches backwards for the last occurence of the specified long value.
 o lastIndexOf(long, int)
Searches backwards for the last occurence of the specified long value, beginning the search at fromIndex.
 o lastIndexOf(Object)
Searches backwards for the last occurence of the specified object, testing for equality using the equals method.
 o lastIndexOf(Object, int)
Searches backwards for the last occurence of the specified object, beginning the search at fromIndex, and testing for equality using the equals method.
 o lastIndexOf(short)
Searches backwards for the last occurence of the specified short value.
 o lastIndexOf(short, int)
Searches backwards for the last occurence of the specified short value, beginning the search at fromIndex.
 o length()
Returns the length of this array, i.e., the number of components in this array.
 o remove(int, int)
Removes the components in this array from the specified offset.
 o removeAll()
Removes all components from this array and sets its length to zero.
 o replace(int, int, VArray)
Replaces the components of this array with the components of the VArray object.
 o replace(int, int, VArray, int, int)
Replaces the components of this array with the components of the VArray object.
 o set(int, Object)
Sets the component at the specified index of this array to be the specified object.
 o setBoolean(int, boolean)
Sets the component at the specified index of this array to be the specified boolean value.
 o setByte(int, byte)
Sets the component at the specified index of this array to be the specified byte value.
 o setChar(int, char)
Sets the component at the specified index of this array to be the specified char value.
 o setDouble(int, double)
Sets the component at the specified index of this array to be the specified double value.
 o setFloat(int, float)
Sets the component at the specified index of this array to be the specified float value.
 o setInt(int, int)
Sets the component at the specified index of this array to be the specified int value.
 o setLength(int)
Sets the length of this array.
 o setLong(int, long)
Sets the component at the specified index of this array to be the specified long value.
 o setShort(int, short)
Sets the component at the specified index of this array to be the specified short value.
 o size()
Returns the size of this array, i.e., the number of components in this array.
 o sort()
Sorts the components of this array.
 o sort(Comparer)
Sorts the components of this array with the specified comparer.
 o sort(int, int, Comparer)
Sorts the components of this array with the specified comparer.
 o subarray(int)
Returns a new array that is a subarray of this array.
 o subarray(int, int)
Returns a new array that is a subarray of this array.
 o toString()
Returns a string representation of this array.
 o trim()
Trims the capacity of this array to be the array's current length.

Constructors

 o VArray
 public VArray(Class componentType)
Constructs an empty array with the specified component type.

Parameters:
componentType - the component type of the array.
 o VArray
 public VArray(Class componentType,
               int initialCapacity)
Constructs an empty array with the specified component type and initial capacity.

Parameters:
componentType - the component type of the array.
initialCapacity - the initial capacity of the array.
 o VArray
 public VArray(Class componentType,
               int initialCapacity,
               int maxCapacityIncrement)
Constructs an empty array with the specified component type, initial capacity, and the maximum capacity increment size.

Parameters:
componentType - the component type of the array.
initialCapacity - the initial capacity of the array.
maxCapacityIncrement - the maximum amount by which the capacity is increased when the array overflows.
 o VArray
 public VArray(Object array)
Constructs an array with the specified array buffer.

Parameters:
array - the buffer of the array.
 o VArray
 public VArray(Object array,
               int maxCapacityIncrement)
Constructs an array with the specified array buffer and the maximum capacity increment size.

Parameters:
array - the buffer of the array.
maxCapacityIncrement - the maximum amount by which the capacity is increased when the array overflows.
 o VArray
 public VArray(String string)
Constructs an array with the contents of the string.

Parameters:
string - a string.
 o VArray
 public VArray(String string,
               int maxCapacityIncrement)
Constructs an array with the contents of the string and the maximum capacity increment size.

Parameters:
string - a string.
maxCapacityIncrement - the maximum amount by which the capacity is increased when the array overflows.

Methods

 o getArray
 public final Object getArray()
Returns the buffer of this array. An application should not modify the returned array.

Returns:
the buffer of this array.
 o getTrimmedArray
 public final Object getTrimmedArray()
Returns an array object whoes length is trimmed to be this array's current length.

Returns:
an array object whoes length is trimmed to be this array's current length.
 o getComponentType
 public final Class getComponentType()
Returns the component type of this array.

Returns:
the component type of this array.
 o size
 public final int size()
Returns the size of this array, i.e., the number of components in this array.

Returns:
the size of this array.
 o getSize
 public final int getSize()
Returns the size of this array, i.e., the number of components in this array.

Returns:
the size of this array.
 o length
 public final int length()
Returns the length of this array, i.e., the number of components in this array.

Returns:
the length of this array.
 o getLength
 public final int getLength()
Returns the length of this array, i.e., the number of components in this array.

Returns:
the length of this array.
 o isEmpty
 public final boolean isEmpty()
Tests if this array has no components.

Returns:
true if this array has no components; false otherwise.
 o hashCode
 public int hashCode()
Returns a hashcode for this array.

Returns:
a hash code value for this array.
Overrides:
hashCode in class Object
 o equals
 public boolean equals(Object anObject)
Compares two Objects for equality.

Parameters:
anObject - the reference object with which to compare.
Returns:
true if this array is the same as the anObject argument; false otherwise.
Overrides:
equals in class Object
 o elements
 public final Enumeration elements()
Returns an enumeration of the components of this array.

Returns:
an enumeration of the components of this array.
 o get
 public final Object get(int index)
Returns the component at the specified index, as an object.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
get
 o getBoolean
 public final boolean getBoolean(int index)
Returns the component at the specified index, as a boolean.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getBoolean
 o getByte
 public final byte getByte(int index)
Returns the component at the specified index, as a byte.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getByte
 o getChar
 public final char getChar(int index)
Returns the component at the specified index, as a char.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getChar
 o getShort
 public final short getShort(int index)
Returns the component at the specified index, as a short.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getShort
 o getInt
 public final int getInt(int index)
Returns the component at the specified index, as an int.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getInt
 o getLong
 public final long getLong(int index)
Returns the component at the specified index, as a long.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getLong
 o getFloat
 public final float getFloat(int index)
Returns the component at the specified index, as a float.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getFloat
 o getDouble
 public final double getDouble(int index)
Returns the component at the specified index, as a double.

Parameters:
index - an index into this array.
Returns:
the component at the specified index.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to the return type.
See Also:
getDouble
 o set
 public final void set(int index,
                       Object value)
Sets the component at the specified index of this array to be the specified object.

Parameters:
index - the specified index.
value - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
set
 o setBoolean
 public final void setBoolean(int index,
                              boolean b)
Sets the component at the specified index of this array to be the specified boolean value.

Parameters:
index - the specified index.
b - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setBoolean
 o setByte
 public final void setByte(int index,
                           byte b)
Sets the component at the specified index of this array to be the specified byte value.

Parameters:
index - the specified index.
b - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setByte
 o setChar
 public final void setChar(int index,
                           char c)
Sets the component at the specified index of this array to be the specified char value.

Parameters:
index - the specified index.
c - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setChar
 o setShort
 public final void setShort(int index,
                            short s)
Sets the component at the specified index of this array to be the specified short value.

Parameters:
index - the specified index.
s - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setShort
 o setInt
 public final void setInt(int index,
                          int i)
Sets the component at the specified index of this array to be the specified int value.

Parameters:
index - the specified index.
i - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setInt
 o setLong
 public final void setLong(int index,
                           long l)
Sets the component at the specified index of this array to be the specified long value.

Parameters:
index - the specified index.
l - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setLong
 o setFloat
 public final void setFloat(int index,
                            float f)
Sets the component at the specified index of this array to be the specified float value.

Parameters:
index - the specified index.
f - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setFloat
 o setDouble
 public final void setDouble(int index,
                             double d)
Sets the component at the specified index of this array to be the specified double value.

Parameters:
index - the specified index.
d - what the component is to be set to.
Throws: ArrayIndexOutOfBoundsException
if an invalid index was given.
Throws: IllegalArgumentException
if the indexed element cannot be converted to this array's component type.
See Also:
setDouble
 o setLength
 public final void setLength(int newLength)
Sets the length of this array.

Parameters:
newLength - the new length of this array.
 o trim
 public final void trim()
Trims the capacity of this array to be the array's current length.

 o indexOf
 public final int indexOf(Object value)
Searches for the first occurence of the specified object, testing for equality using the equals method.

Parameters:
value - the specified object.
Returns:
the index of the first occurrence of the specified object in this array; returns -1 if the object is not found.
See Also:
equals
 o indexOf
 public final int indexOf(Object value,
                          int fromIndex)
Searches for the first occurence of the specified object, beginning the search at fromIndex, and testing for equality using the equals method.

Parameters:
value - the specified object.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified object in this array; returns -1 if the object is not found.
See Also:
equals
 o lastIndexOf
 public final int lastIndexOf(Object value)
Searches backwards for the last occurence of the specified object, testing for equality using the equals method.

Parameters:
value - the specified object.
Returns:
the index of the last occurrence of the specified object in this array; returns -1 if the object is not found.
See Also:
equals
 o lastIndexOf
 public final int lastIndexOf(Object value,
                              int fromIndex)
Searches backwards for the last occurence of the specified object, beginning the search at fromIndex, and testing for equality using the equals method.

Parameters:
value - the specified object.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified object in this array; returns -1 if the object is not found.
See Also:
equals
 o indexOf
 public final int indexOf(boolean b)
Searches for the first occurence of the specified boolean value.

Parameters:
b - the specified boolean value.
Returns:
the index of the first occurrence of the specified boolean value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(boolean b,
                          int fromIndex)
Searches for the first occurence of the specified boolean value, beginning the search at fromIndex.

Parameters:
b - the specified boolean value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified boolean value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(boolean b)
Searches backwards for the last occurence of the specified boolean value.

Parameters:
b - the specified boolean value.
Returns:
the index of the last occurrence of the specified boolean value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(boolean b,
                              int fromIndex)
Searches backwards for the last occurence of the specified boolean value, beginning the search at fromIndex.

Parameters:
b - the specified boolean value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified boolean value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(byte b)
Searches for the first occurence of the specified byte value.

Parameters:
b - the specified byte value.
Returns:
the index of the first occurrence of the specified byte value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(byte b,
                          int fromIndex)
Searches for the first occurence of the specified byte value, beginning the search at fromIndex.

Parameters:
b - the specified byte value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified byte value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(byte b)
Searches backwards for the last occurence of the specified byte value.

Parameters:
b - the specified byte value.
Returns:
the index of the last occurrence of the specified byte value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(byte b,
                              int fromIndex)
Searches backwards for the last occurence of the specified byte value, beginning the search at fromIndex.

Parameters:
b - the specified byte value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified byte value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(char c)
Searches for the first occurence of the specified char value.

Parameters:
c - the specified char value.
Returns:
the index of the first occurrence of the specified char value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(char c,
                          int fromIndex)
Searches for the first occurence of the specified char value, beginning the search at fromIndex.

Parameters:
c - the specified char value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified char value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(char c)
Searches backwards for the last occurence of the specified char value.

Parameters:
c - the specified char value.
Returns:
the index of the last occurrence of the specified char value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(char c,
                              int fromIndex)
Searches backwards for the last occurence of the specified char value, beginning the search at fromIndex.

Parameters:
c - the specified char value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified char value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(short s)
Searches for the first occurence of the specified short value.

Parameters:
s - the specified short value.
Returns:
the index of the first occurrence of the specified short value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(short s,
                          int fromIndex)
Searches for the first occurence of the specified short value, beginning the search at fromIndex.

Parameters:
s - the specified short value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified short value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(short s)
Searches backwards for the last occurence of the specified short value.

Parameters:
s - the specified short value.
Returns:
the index of the last occurrence of the specified short value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(short s,
                              int fromIndex)
Searches backwards for the last occurence of the specified short value, beginning the search at fromIndex.

Parameters:
s - the specified short value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified short value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(int iv)
Searches for the first occurence of the specified int value.

Parameters:
iv - the specified int value.
Returns:
the index of the first occurrence of the specified int value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(int iv,
                          int fromIndex)
Searches for the first occurence of the specified int value, beginning the search at fromIndex.

Parameters:
iv - the specified int value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified int value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(int iv)
Searches backwards for the last occurence of the specified int value.

Parameters:
iv - the specified int value.
Returns:
the index of the last occurrence of the specified int value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(int iv,
                              int fromIndex)
Searches backwards for the last occurence of the specified int value, beginning the search at fromIndex.

Parameters:
iv - the specified int value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified int value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(long l)
Searches for the first occurence of the specified long value.

Parameters:
l - the specified long value.
Returns:
the index of the first occurrence of the specified long value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(long l,
                          int fromIndex)
Searches for the first occurence of the specified long value, beginning the search at fromIndex.

Parameters:
l - the specified long value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified long value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(long l)
Searches backwards for the last occurence of the specified long value.

Parameters:
l - the specified long value.
Returns:
the index of the last occurrence of the specified long value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(long l,
                              int fromIndex)
Searches backwards for the last occurence of the specified long value, beginning the search at fromIndex.

Parameters:
l - the specified long value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified long value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(float f)
Searches for the first occurence of the specified float value.

Parameters:
f - the specified float value.
Returns:
the index of the first occurrence of the specified float value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(float f,
                          int fromIndex)
Searches for the first occurence of the specified float value, beginning the search at fromIndex.

Parameters:
f - the specified float value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified float value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(float f)
Searches backwards for the last occurence of the specified float value.

Parameters:
f - the specified float value.
Returns:
the index of the last occurrence of the specified float value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(float f,
                              int fromIndex)
Searches backwards for the last occurence of the specified float value, beginning the search at fromIndex.

Parameters:
f - the specified float value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified float value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(double d)
Searches for the first occurence of the specified double value.

Parameters:
d - the specified double value.
Returns:
the index of the first occurrence of the specified double value in this array; returns -1 if the value is not found.
 o indexOf
 public final int indexOf(double d,
                          int fromIndex)
Searches for the first occurence of the specified double value, beginning the search at fromIndex.

Parameters:
d - the specified double value.
fromIndex - the index to start searching from.
Returns:
the index of the first occurrence of the specified double value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(double d)
Searches backwards for the last occurence of the specified double value.

Parameters:
d - the specified double value.
Returns:
the index of the last occurrence of the specified double value in this array; returns -1 if the value is not found.
 o lastIndexOf
 public final int lastIndexOf(double d,
                              int fromIndex)
Searches backwards for the last occurence of the specified double value, beginning the search at fromIndex.

Parameters:
d - the specified double value.
fromIndex - the index to start searching from.
Returns:
the index of the last occurrence of the specified double value in this array; returns -1 if the value is not found.
 o removeAll
 public final void removeAll()
Removes all components from this array and sets its length to zero.

 o remove
 public final void remove(int offset,
                          int size)
Removes the components in this array from the specified offset. The number of the components to be removed is specified by the size. Each component in this array with an index greater or equal to offset+size is shifted downward.

Parameters:
offset - the start index of the components to be removed.
size - the number of the components to be removed.
Throws: ArrayIndexOutOfBoundsException
if the offset or the size were invalid.
 o subarray
 public final VArray subarray(int beginIndex)
Returns a new array that is a subarray of this array. The subarray begins at the specified index and extends to the end of this array.

Parameters:
beginIndex - the beginning index, inclusive.
Returns:
the subarray.
Throws: ArrayIndexOutOfBoundsException
if the beginIndex is out of range.
 o subarray
 public final VArray subarray(int beginIndex,
                              int endIndex)
Returns a new array that is a subarray of this array. The subarray begins at the specified beginIndex and extends to the component at index endIndex-1.

Parameters:
beginIndex - the beginning index, inclusive.
endIndex - the ending index, exclusive.
Returns:
the subarray.
Throws: ArrayIndexOutOfBoundsException
if the beginIndex or the endIndex is out of range.
 o append
 public final VArray append(Object value)
Appends the object to this array.

Parameters:
value - an object.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(boolean b)
Appends the boolean value to this array.

Parameters:
b - a boolean value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(byte b)
Appends the byte value to this array.

Parameters:
b - a byte value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(char c)
Appends the char value to this array.

Parameters:
c - a char value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(short s)
Appends the short value to this array.

Parameters:
s - a short value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(int i)
Appends the int value to this array.

Parameters:
i - an int value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(long l)
Appends the long value to this array.

Parameters:
l - a long value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(float f)
Appends the float value to this array.

Parameters:
f - a float value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(double d)
Appends the double value to this array.

Parameters:
d - a double value.
Returns:
this array.
Throws: IllegalArgumentException
if the value cannot be converted to this array's component type.
 o append
 public final VArray append(String str)
Appends the characters of the string to this array.

Parameters:
str - a string.
Returns:
this array.
Throws: IllegalArgumentException
if the character value cannot be converted to this array's component type.
 o append
 public final VArray append(String str,
                            int begin,
                            int end)
Appends the characters of the string from the specified begin index to the specified endIndex-1 index.

Parameters:
str - a string.
begin - the beginning index of the string, inclusive.
end - the ending index of the string, exclusive.
Returns:
this array.
Throws: IllegalArgumentException
if the character value cannot be converted to this array's component type.
 o append
 public final VArray append(char carray[])
Appends the characters of the array object to this array.

Parameters:
carray - an array of characters.
Returns:
this array.
Throws: IllegalArgumentException
if the character value cannot be converted to this array's component type.
 o append
 public final VArray append(char carray[],
                            int begin,
                            int end)
Appends the characters of the array object to this array.

Parameters:
carray - an array of characters.
begin - the beginning index of the character array, inclusive.
end - the ending index of the character array, exclusive.
Returns:
this array.
Throws: IllegalArgumentException
if the character value cannot be converted to this array's component type.
Throws: ArrayIndexOutOfBoundsException
if the begin or the end is out of range.
 o append
 public final VArray append(VArray varray)
Appends the components of the VArray object to this array.

Parameters:
varray - an VArray object.
Returns:
this array.
Throws: IllegalArgumentException
if the component type of the argument cannot be converted to this array's component type.
 o append
 public final VArray append(VArray varray,
                            int begin,
                            int end)
Appends the components of the VArray object to this array.

Parameters:
varray - an VArray object.
begin - the beginning index of the array, inclusive.
end - the ending index of the array, exclusive.
Returns:
this array.
Throws: IllegalArgumentException
if the component type of the argument cannot be converted to this array's component type.
Throws: ArrayIndexOutOfBoundsException
if the begin or the end is out of range.
 o insert
 public final VArray insert(int offset,
                            VArray varray)
Inserts the components of the VArray object to this array from the specified offset.

Parameters:
offset - the start index of the components to be inserted.
varray - an VArray object.
Returns:
this array.
Throws: IllegalArgumentException
if the component type of the argument cannot be converted to this array's component type.
 o insert
 public final VArray insert(int offset,
                            VArray varray,
                            int begin,
                            int end)
Inserts the components of the VArray object to this array from the specified offset.

Parameters:
offset - the start index of the components to be inserted.
varray - an VArray object.
begin - the beginning index of the array, inclusive.
end - the ending index of the array, exclusive.
Returns:
this array.
Throws: IllegalArgumentException
if the component type of the argument cannot be converted to this array's component type.
Throws: ArrayIndexOutOfBoundsException
if the begin or the end is out of range.
 o replace
 public final VArray replace(int begin,
                             int end,
                             VArray varray)
Replaces the components of this array with the components of the VArray object.

Parameters:
begin - the beginning index to replace, inclusive.
end - the ending index to replace, exclusive.
varray - a replacement VArray object.
Returns:
this array.
Throws: IllegalArgumentException
if the component type of the argument cannot be converted to this array's component type.
 o replace
 public final VArray replace(int begin,
                             int end,
                             VArray varray,
                             int rBegin,
                             int rEnd)
Replaces the components of this array with the components of the VArray object.

Parameters:
begin - the beginning index to replace, inclusive.
end - the ending index to replace, exclusive.
varray - a replacement VArray object.
rBegin - the beginning index of the replacement, inclusive.
rEnd - the ending index of the replacement, exclusive.
Returns:
this array.
Throws: IllegalArgumentException
if the component type of the argument cannot be converted to this array's component type.
Throws: ArrayIndexOutOfBoundsException
if the begin, the end, the rBegin, or the rEnd is out of range.
 o sort
 public final void sort()
Sorts the components of this array.

See Also:
quicksort
 o sort
 public final void sort(Comparer comparer)
Sorts the components of this array with the specified comparer.

Parameters:
comparer - a comparer used by sorting.
See Also:
Comparer, quicksort
 o sort
 public final void sort(int i,
                        int j,
                        Comparer comparer)
Sorts the components of this array with the specified comparer.

Parameters:
i - the beginning index to sort, inclusive.
j - the ending index to sort, inclusive.
comparer - a comparer used by sorting.
See Also:
Comparer, quicksort
 o clone
 public Object clone()
Returns a clone of this array.

Returns:
a clone of this array.
Overrides:
clone in class Object
 o toString
 public String toString()
Returns a string representation of this array.

Returns:
a string representation of this array.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index