head 1.1; branch 1.1.1; access ; symbols DEVEL:1.1.1.1 HEAD:1.1.1; locks ; strict; comment @# @; 1.1 date 2001.03.16.18.13.09; author jallali; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.03.16.18.13.09; author jallali; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @

Overview | Package | Class | Tree | Deprecated | Index | Help
| EJCL Xtreme for PalmOS
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.util
Class Vector

    java.lang.Object
      |
      +--java.util.Vector

public class Vector
extends Object
implements Cloneable, Serializable

Vector is a variable size contiguous indexable array of Objects. The size of the Vector is the number of Objects it contains. The capacity of the Vector is the number of Objects it can hold.

Objects may be inserted at any position up to the size of the Vector, increasing the size of the Vector. Objects at any position in the Vector may be removed, shrinking the size of the Vector. Objects at any position in the Vector may be replaced, which does not affect the Vector size.

The capacity of a Vector may be specified when the Vector is created. If the capacity of the Vector is exceeded, the capacity is increased, doubling by default.

See Also:
  `StringBuffer`, Serialized Form

Field Summary
`protected int` | `capacityIncrement` The amount by which the capacity of the vector is increased.
`protected int` | `elementCount` The number of elements or the size of the vector.
`protected Object[]` | `elementData` The elements of the vector.

Constructor Summary
`Vector()` Constructs a new Vector using the default capacity.
`Vector(int capacity)` Constructs a new Vector using the specified capacity.
`Vector(int capacity, int capacityIncrement)` Constructs a new Vector using the specified capacity and capacity increment.

Method Summary
`void` | `addElement(Object object)` Adds the specified object at the end of this Vector.
`Object` | `clone()` Answers a new Vector with the same elements, size, capacity and capacity increment as this Vector.
`boolean` | `contains(Object object)` Searches this Vector for the specified object.
`void` | `copyInto(Object[] elements)` Copies the elements of this Vector into the specified Object array.
`Object` | `elementAt(int location)` Answers the element at the specified location in this Vector.
`int` | `indexOf(Object object, int location)` Searches in this Vector for the index of the specified object.
`void` | `insertElementAt(Object object, int location)` Inserts the specified object into this Vector at the specified location.
`int` | `lastIndexOf(Object object)` Searches in this Vector for the index of the specified object.
`int` | `lastIndexOf(Object object, int location)` Searches in this Vector for the index of the specified object.
`void` | `removeAllElements()` Removes all elements from this Vector, leaving the size zero and the capacity unchanged.
`boolean` | `removeElement(Object object)` Removes the first occurrence, starting at the beginning and moving towards the end, of the specified object from this Vector.
`void` | `removeElementAt(int location)` Removes the element at the specified location from this Vector.
`void` | `setElementAt(Object object, int location)` Replaces the element at the specified location in this Vector with the specified object.
`int` | `size()` Answers the number of elements in this Vector.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### elementCount

    protected int elementCount

  The number of elements or the size of the vector.

### elementData

    protected Object[] elementData

  The elements of the vector.

### capacityIncrement

    protected int capacityIncrement

  The amount by which the capacity of the vector is increased.

Constructor Detail

### Vector

    public Vector()

  Constructs a new Vector using the default capacity.

### Vector

    public Vector(int capacity)

  Constructs a new Vector using the specified capacity.
  Parameters:
    `capacity` - the initial capacity of the new vector

### Vector

    public Vector(int capacity,
                  int capacityIncrement)

  Constructs a new Vector using the specified capacity and capacity increment.
  Parameters:
    `capacity` - the initial capacity of the new Vector
    `capacityIncrement` - the amount to increase the capacity when this Vector is full

Method Detail

### addElement

    public void addElement(Object object)

  Adds the specified object at the end of this Vector.
  Parameters:
    `object` - the object to add to the Vector

### clone

    public Object clone()

  Answers a new Vector with the same elements, size, capacity and capacity increment as this Vector.
  Overrides:
    clone in class Object
  Returns:
    a shallow copy of this Vector
  See Also:
    `Cloneable`

### contains

    public boolean contains(Object object)

  Searches this Vector for the specified object.
  Parameters:
    `object` - the object to look for in this Vector
  Returns:
    true if object is an element of this Vector, false otherwise
  See Also:
    `indexOf(java.lang.Object, int)`, `Object.equals(java.lang.Object)`

### copyInto

    public void copyInto(Object[] elements)

  Copies the elements of this Vector into the specified Object array.
  Parameters:
    `elements` - the Object array into which the elements of this Vector are copied
  See Also:
    `clone()`

### elementAt

    public Object elementAt(int location)

  Answers the element at the specified location in this Vector.
  Parameters:
    `location` - the index of the element to return in this Vector
  Returns:
    the element at the specified location
  Throws:
    ArrayIndexOutOfBoundsException - when `location < 0 || >= size()`
  See Also:
    `size()`

### indexOf

    public int indexOf(Object object,
                       int location)

  Searches in this Vector for the index of the specified object. The search for the object starts at the specified location and moves towards the end of this Vector.
  Parameters:
    `object` - the object to find in this Vector
    `location` - the index at which to start searching
  Returns:
    the index in this Vector of the specified element, -1 if the element isn't found
  Throws:
    ArrayIndexOutOfBoundsException - when `location < 0`
  See Also:
    `contains(java.lang.Object)`, `lastIndexOf(java.lang.Object)`

### insertElementAt

    public void insertElementAt(Object object,
                                int location)

  Inserts the specified object into this Vector at the specified location. This object is inserted before any previous element at the specified location. If the location is equal to the size of this Vector, the object is added at the end.
  Parameters:
    `object` - the object to insert in this Vector
    `location` - the index at which to insert the element
  Throws:
    ArrayIndexOutOfBoundsException - when `location < 0 || > size()`
  See Also:
    `addElement(java.lang.Object)`, `size()`

### lastIndexOf

    public int lastIndexOf(Object object)

  Searches in this Vector for the index of the specified object. The search for the object starts at the end and moves towards the start of this Vector.
  Parameters:
    `object` - the object to find in this Vector
  Returns:
    the index in this Vector of the specified element, -1 if the element isn't found
  See Also:
    `contains(java.lang.Object)`, `indexOf(java.lang.Object, int)`

### lastIndexOf

    public int lastIndexOf(Object object,
                           int location)

  Searches in this Vector for the index of the specified object. The search for the object starts at the specified location and moves towards the start of this Vector.
  Parameters:
    `object` - the object to find in this Vector
    `location` - the index at which to start searching
  Returns:
    the index in this Vector of the specified element, -1 if the element isn't found
  Throws:
    ArrayIndexOutOfBoundsException - when `location >= size()`
  See Also:
    `contains(java.lang.Object)`, `indexOf(java.lang.Object, int)`

### removeAllElements

    public void removeAllElements()

  Removes all elements from this Vector, leaving the size zero and the capacity unchanged.
  See Also:
    `#isEmpty`, `size()`

### removeElement

    public boolean removeElement(Object object)

  Removes the first occurrence, starting at the beginning and moving towards the end, of the specified object from this Vector.
  Parameters:
    `object` - the object to remove from this Vector
  Returns:
    true if the specified object was found, false otherwise
  See Also:
    `removeAllElements()`, `removeElementAt(int)`, `size()`

### removeElementAt

    public void removeElementAt(int location)

  Removes the element at the specified location from this Vector.
  Parameters:
    `location` - the index of the element to remove
  Throws:
    ArrayIndexOutOfBoundsException - when `location < 0 || >= size()`
  See Also:
    `removeElement(java.lang.Object)`, `removeAllElements()`, `size()`

### setElementAt

    public void setElementAt(Object object,
                             int location)

  Replaces the element at the specified location in this Vector with the specified object.
  Parameters:
    `object` - the object to add to this Vector
    `location` - the index at which to put the specified object
  Throws:
    ArrayIndexOutOfBoundsException - when `location < 0 || >= size()`
  See Also:
    `size()`

### size

    public int size()

  Answers the number of elements in this Vector.
  Returns:
    the number of elements in this Vector
  See Also:
    `elementCount`, `#lastElement`

Overview | Package | Class | Tree | Deprecated | Index | Help
| EJCL Xtreme for PalmOS
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

@ 1.1.1.1 log @import initial @ text @@