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