java.util
Class Vector
java.lang.Object
java.util.Vector
- Direct Known Subclasses:
- Queue, Stack
public class Vector
- extends Object
A dynamic array.
Constructor Summary |
Vector()
|
Vector(int initialCapacity)
|
Vector(int initialCapacity,
int capacityIncrement)
|
elementData
protected Object[] elementData
capacityIncrement
protected int capacityIncrement
elementCount
protected int elementCount
Vector
public Vector(int initialCapacity,
int capacityIncrement)
Vector
public Vector(int initialCapacity)
Vector
public Vector()
elements
public Enumeration elements()
- Returns a convenient Enumaration object to cycle through elements in Vector.
- Returns:
- an Enumeration of all the objects in the Vector
addElement
public void addElement(Object aObj)
capacity
public int capacity()
clear
public void clear()
elementAt
public Object elementAt(int aIndex)
ensureCapacity
public void ensureCapacity(int minCapacity)
equals
public boolean equals(Object aObj)
- Overrides:
equals
in class Object
indexOf
public int indexOf(Object aObj)
indexOf
public int indexOf(Object aObj,
int aIndex)
insertElementAt
public void insertElementAt(Object aObj,
int aIndex)
isEmpty
public boolean isEmpty()
lastIndexOf
public int lastIndexOf(Object anObject)
- delivers the index of the last occurrence of the object
- Parameters:
anObject
- the object
- Returns:
- the index of the last occurrence of the object
or -1, if object is not found
lastIndexOf
public int lastIndexOf(Object anObject,
int anIndex)
throws ArrayIndexOutOfBoundsException
- delivers the index of the last occurrence of the object
starting from some index
- Parameters:
anObject
- the objectanIndex
- the starting index
- Returns:
- the index of the last occurrence of the object
or -1, if object is not found
- Throws:
ArrayIndexOutOfBoundsException
removeAllElements
public void removeAllElements()
removeElement
public boolean removeElement(Object aObj)
removeElementAt
public void removeElementAt(int aIndex)
setElementAt
public void setElementAt(Object aObj,
int aIndex)
setSize
public void setSize(int aSize)
size
public int size()
toArray
public Object[] toArray()
trimToSize
public void trimToSize()