java.util
Class Vector<E>

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
      extended by java.util.AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
          extended by java.util.Vector<E>
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Iterable sample code for java.lang.Iterable definition code for java.lang.Iterable <E>, Collection sample code for java.util.Collection definition code for java.util.Collection <E>, List sample code for java.util.List definition code for java.util.List <E>, RandomAccess sample code for java.util.RandomAccess definition code for java.util.RandomAccess
Direct Known Subclasses:
Stack sample code for java.util.Stack definition code for java.util.Stack

public class Vector<E>
extends AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
implements List sample code for java.util.List definition code for java.util.List <E>, RandomAccess sample code for java.util.RandomAccess definition code for java.util.RandomAccess , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.

Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. The capacity is always at least as large as the vector size; it is usually larger because as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement. An application can increase the capacity of a vector before inserting a large number of components; this reduces the amount of incremental reallocation.

As of the Java 2 platform v1.2, this class has been retrofitted to implement List, so that it becomes a part of Java's collection framework. Unlike the new collection implementations, Vector is synchronized.

The Iterators returned by Vector's iterator and listIterator methods are fail-fast: if the Vector is structurally modified at any time after the Iterator is created, in any way except through the Iterator's own remove or add methods, the Iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the Iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future. The Enumerations returned by Vector's elements method are not fail-fast.

Note that the fail-fast behavior of an iterator cannot be guaranteed as it is, generally speaking, impossible to make any hard guarantees in the presence of unsynchronized concurrent modification. Fail-fast iterators throw ConcurrentModificationException on a best-effort basis. Therefore, it would be wrong to write a program that depended on this exception for its correctness: the fail-fast behavior of iterators should be used only to detect bugs.

This class is a member of the Java Collections Framework.

Since:
JDK1.0
See Also:
Collection sample code for java.util.Collection definition code for java.util.Collection , List sample code for java.util.List definition code for java.util.List , ArrayList sample code for java.util.ArrayList definition code for java.util.ArrayList , LinkedList sample code for java.util.LinkedList definition code for java.util.LinkedList , Serialized Form

Field Summary
protected  int capacityIncrement sample code for java.util.Vector.capacityIncrement definition code for java.util.Vector.capacityIncrement
          The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity.
protected  int elementCount sample code for java.util.Vector.elementCount definition code for java.util.Vector.elementCount
          The number of valid components in this Vector object.
protected  Object sample code for java.lang.Object definition code for java.lang.Object [] elementData sample code for java.util.Vector.elementData definition code for java.util.Vector.elementData
          The array buffer into which the components of the vector are stored.
 
Fields inherited from class java.util.AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList
modCount sample code for java.util.AbstractList.modCount definition code for java.util.AbstractList.modCount
 
Constructor Summary
Vector sample code for java.util.Vector.Vector() definition code for java.util.Vector.Vector() ()
          Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.
Vector sample code for java.util.Vector.Vector(java.util.Collection) definition code for java.util.Vector.Vector(java.util.Collection) (Collection sample code for java.util.Collection definition code for java.util.Collection <? extends E> c)
          Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator.
Vector sample code for java.util.Vector.Vector(int) definition code for java.util.Vector.Vector(int) (int initialCapacity)
          Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero.
Vector sample code for java.util.Vector.Vector(int, int) definition code for java.util.Vector.Vector(int, int) (int initialCapacity, int capacityIncrement)
          Constructs an empty vector with the specified initial capacity and capacity increment.
 
Method Summary
 boolean add sample code for java.util.Vector.add(E) definition code for java.util.Vector.add(E) (E o)
          Appends the specified element to the end of this Vector.
 void add sample code for java.util.Vector.add(int, E) definition code for java.util.Vector.add(int, E) (int index, E element)
          Inserts the specified element at the specified position in this Vector.
 boolean addAll sample code for java.util.Vector.addAll(java.util.Collection) definition code for java.util.Vector.addAll(java.util.Collection) (Collection sample code for java.util.Collection definition code for java.util.Collection <? extends E> c)
          Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.
 boolean addAll sample code for java.util.Vector.addAll(int, java.util.Collection) definition code for java.util.Vector.addAll(int, java.util.Collection) (int index, Collection sample code for java.util.Collection definition code for java.util.Collection <? extends E> c)
          Inserts all of the elements in the specified Collection into this Vector at the specified position.
 void addElement sample code for java.util.Vector.addElement(E) definition code for java.util.Vector.addElement(E) (E obj)
          Adds the specified component to the end of this vector, increasing its size by one.
 int capacity sample code for java.util.Vector.capacity() definition code for java.util.Vector.capacity() ()
          Returns the current capacity of this vector.
 void clear sample code for java.util.Vector.clear() definition code for java.util.Vector.clear() ()
          Removes all of the elements from this Vector.
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for java.util.Vector.clone() definition code for java.util.Vector.clone() ()
          Returns a clone of this vector.
 boolean contains sample code for java.util.Vector.contains(java.lang.Object) definition code for java.util.Vector.contains(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  elem)
          Tests if the specified object is a component in this vector.
 boolean containsAll sample code for java.util.Vector.containsAll(java.util.Collection) definition code for java.util.Vector.containsAll(java.util.Collection) (Collection sample code for java.util.Collection definition code for java.util.Collection <?> c)
          Returns true if this Vector contains all of the elements in the specified Collection.
 void copyInto sample code for java.util.Vector.copyInto(java.lang.Object[]) definition code for java.util.Vector.copyInto(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] anArray)
          Copies the components of this vector into the specified array.
 E elementAt sample code for java.util.Vector.elementAt(int) definition code for java.util.Vector.elementAt(int) (int index)
          Returns the component at the specified index.
 Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <E> elements sample code for java.util.Vector.elements() definition code for java.util.Vector.elements() ()
          Returns an enumeration of the components of this vector.
 void ensureCapacity sample code for java.util.Vector.ensureCapacity(int) definition code for java.util.Vector.ensureCapacity(int) (int minCapacity)
          Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
 boolean equals sample code for java.util.Vector.equals(java.lang.Object) definition code for java.util.Vector.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  o)
          Compares the specified Object with this Vector for equality.
 E firstElement sample code for java.util.Vector.firstElement() definition code for java.util.Vector.firstElement() ()
          Returns the first component (the item at index 0) of this vector.
 E get sample code for java.util.Vector.get(int) definition code for java.util.Vector.get(int) (int index)
          Returns the element at the specified position in this Vector.
 int hashCode sample code for java.util.Vector.hashCode() definition code for java.util.Vector.hashCode() ()
          Returns the hash code value for this Vector.
 int indexOf sample code for java.util.Vector.indexOf(java.lang.Object) definition code for java.util.Vector.indexOf(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  elem)
          Searches for the first occurence of the given argument, testing for equality using the equals method.
 int indexOf sample code for java.util.Vector.indexOf(java.lang.Object, int) definition code for java.util.Vector.indexOf(java.lang.Object, int) (Object sample code for java.lang.Object definition code for java.lang.Object  elem, int index)
          Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
 void insertElementAt sample code for java.util.Vector.insertElementAt(E, int) definition code for java.util.Vector.insertElementAt(E, int) (E obj, int index)
          Inserts the specified object as a component in this vector at the specified index.
 boolean isEmpty sample code for java.util.Vector.isEmpty() definition code for java.util.Vector.isEmpty() ()
          Tests if this vector has no components.
 E lastElement sample code for java.util.Vector.lastElement() definition code for java.util.Vector.lastElement() ()
          Returns the last component of the vector.
 int lastIndexOf sample code for java.util.Vector.lastIndexOf(java.lang.Object) definition code for java.util.Vector.lastIndexOf(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  elem)
          Returns the index of the last occurrence of the specified object in this vector.
 int lastIndexOf sample code for java.util.Vector.lastIndexOf(java.lang.Object, int) definition code for java.util.Vector.lastIndexOf(java.lang.Object, int) (Object sample code for java.lang.Object definition code for java.lang.Object  elem, int index)
          Searches backwards for the specified object, starting from the specified index, and returns an index to it.
 E remove sample code for java.util.Vector.remove(int) definition code for java.util.Vector.remove(int) (int index)
          Removes the element at the specified position in this Vector.
 boolean remove sample code for java.util.Vector.remove(java.lang.Object) definition code for java.util.Vector.remove(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  o)
          Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged.
 boolean removeAll sample code for java.util.Vector.removeAll(java.util.Collection) definition code for java.util.Vector.removeAll(java.util.Collection) (Collection sample code for java.util.Collection definition code for java.util.Collection <?> c)
          Removes from this Vector all of its elements that are contained in the specified Collection.
 void removeAllElements sample code for java.util.Vector.removeAllElements() definition code for java.util.Vector.removeAllElements() ()
          Removes all components from this vector and sets its size to zero.
 boolean removeElement sample code for java.util.Vector.removeElement(java.lang.Object) definition code for java.util.Vector.removeElement(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Removes the first (lowest-indexed) occurrence of the argument from this vector.
 void removeElementAt sample code for java.util.Vector.removeElementAt(int) definition code for java.util.Vector.removeElementAt(int) (int index)
          Deletes the component at the specified index.
protected  void removeRange sample code for java.util.Vector.removeRange(int, int) definition code for java.util.Vector.removeRange(int, int) (int fromIndex, int toIndex)
          Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
 boolean retainAll sample code for java.util.Vector.retainAll(java.util.Collection) definition code for java.util.Vector.retainAll(java.util.Collection) (Collection sample code for java.util.Collection definition code for java.util.Collection <?> c)
          Retains only the elements in this Vector that are contained in the specified Collection.
 E set sample code for java.util.Vector.set(int, E) definition code for java.util.Vector.set(int, E) (int index, E element)
          Replaces the element at the specified position in this Vector with the specified element.
 void setElementAt sample code for java.util.Vector.setElementAt(E, int) definition code for java.util.Vector.setElementAt(E, int) (E obj, int index)
          Sets the component at the specified index of this vector to be the specified object.
 void setSize sample code for java.util.Vector.setSize(int) definition code for java.util.Vector.setSize(int) (int newSize)
          Sets the size of this vector.
 int size sample code for java.util.Vector.size() definition code for java.util.Vector.size() ()
          Returns the number of components in this vector.
 List sample code for java.util.List definition code for java.util.List <E> subList sample code for java.util.Vector.subList(int, int) definition code for java.util.Vector.subList(int, int) (int fromIndex, int toIndex)
          Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive.
 Object sample code for java.lang.Object definition code for java.lang.Object [] toArray sample code for java.util.Vector.toArray() definition code for java.util.Vector.toArray() ()
          Returns an array containing all of the elements in this Vector in the correct order.
<T> T[]
toArray sample code for java.util.Vector.toArray(T[]) definition code for java.util.Vector.toArray(T[]) (T[] a)
          Returns an array containing all of the elements in this Vector in the correct order; the runtime type of the returned array is that of the specified array.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Vector.toString() definition code for java.util.Vector.toString() ()
          Returns a string representation of this Vector, containing the String representation of each element.
 void trimToSize sample code for java.util.Vector.trimToSize() definition code for java.util.Vector.trimToSize() ()
          Trims the capacity of this vector to be the vector's current size.
 
Methods inherited from class java.util.AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList
iterator sample code for java.util.AbstractList.iterator() definition code for java.util.AbstractList.iterator() , listIterator sample code for java.util.AbstractList.listIterator() definition code for java.util.AbstractList.listIterator() , listIterator sample code for java.util.AbstractList.listIterator(int) definition code for java.util.AbstractList.listIterator(int)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface java.util.List sample code for java.util.List definition code for java.util.List
iterator sample code for java.util.List.iterator() definition code for java.util.List.iterator() , listIterator sample code for java.util.List.listIterator() definition code for java.util.List.listIterator() , listIterator sample code for java.util.List.listIterator(int) definition code for java.util.List.listIterator(int)
 

Field Detail

elementData sample code for java.util.Vector.elementData

protected Object sample code for java.lang.Object definition code for java.lang.Object [] elementData
The array buffer into which the components of the vector are stored. The capacity of the vector is the length of this array buffer, and is at least large enough to contain all the vector's elements.

Any array elements following the last element in the Vector are null.


elementCount sample code for java.util.Vector.elementCount

protected int elementCount
The number of valid components in this Vector object. Components elementData[0] through elementData[elementCount-1] are the actual items.


capacityIncrement sample code for java.util.Vector.capacityIncrement

protected int capacityIncrement
The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity. If the capacity increment is less than or equal to zero, the capacity of the vector is doubled each time it needs to grow.

Constructor Detail

Vector sample code for java.util.Vector(int, int) definition code for java.util.Vector(int, int)

public Vector(int initialCapacity,
              int capacityIncrement)
Constructs an empty vector with the specified initial capacity and capacity increment.

Parameters:
initialCapacity - the initial capacity of the vector.
capacityIncrement - the amount by which the capacity is increased when the vector overflows.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the specified initial capacity is negative

Vector sample code for java.util.Vector(int) definition code for java.util.Vector(int)

public Vector(int initialCapacity)
Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero.

Parameters:
initialCapacity - the initial capacity of the vector.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the specified initial capacity is negative

Vector sample code for java.util.Vector() definition code for java.util.Vector()

public Vector()
Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.


Vector sample code for java.util.Vector(java.util.Collection<? extends E>) definition code for java.util.Vector(java.util.Collection<? extends E>)

public Vector(Collection sample code for java.util.Collection definition code for java.util.Collection <? extends E> c)
Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Parameters:
c - the collection whose elements are to be placed into this vector.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the specified collection is null.
Since:
1.2
Method Detail

copyInto sample code for java.util.Vector.copyInto(java.lang.Object[]) definition code for java.util.Vector.copyInto(java.lang.Object[])

public void copyInto(Object sample code for java.lang.Object definition code for java.lang.Object [] anArray)
Copies the components of this vector into the specified array. The item at index k in this vector is copied into component k of anArray. The array must be big enough to hold all the objects in this vector, else an IndexOutOfBoundsException is thrown.

Parameters:
anArray - the array into which the components get copied.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the given array is null.

trimToSize sample code for java.util.Vector.trimToSize() definition code for java.util.Vector.trimToSize()

public void trimToSize()
Trims the capacity of this vector to be the vector's current size. If the capacity of this vector is larger than its current size, then the capacity is changed to equal the size by replacing its internal data array, kept in the field elementData, with a smaller one. An application can use this operation to minimize the storage of a vector.


ensureCapacity sample code for java.util.Vector.ensureCapacity(int) definition code for java.util.Vector.ensureCapacity(int)

public void ensureCapacity(int minCapacity)
Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.

If the current capacity of this vector is less than minCapacity, then its capacity is increased by replacing its internal data array, kept in the field elementData, with a larger one. The size of the new data array will be the old size plus capacityIncrement, unless the value of capacityIncrement is less than or equal to zero, in which case the new capacity will be twice the old capacity; but if this new size is still smaller than minCapacity, then the new capacity will be minCapacity.

Parameters:
minCapacity - the desired minimum capacity.

setSize sample code for java.util.Vector.setSize(int) definition code for java.util.Vector.setSize(int)

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

Parameters:
newSize - the new size of this vector.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if new size is negative.

capacity sample code for java.util.Vector.capacity() definition code for java.util.Vector.capacity()

public int capacity()
Returns the current capacity of this vector.

Returns:
the current capacity (the length of its internal data array, kept in the field elementData of this vector).

size sample code for java.util.Vector.size() definition code for java.util.Vector.size()

public int size()
Returns the number of components in this vector.

Specified by:
size sample code for java.util.Collection.size() definition code for java.util.Collection.size() in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
size sample code for java.util.List.size() definition code for java.util.List.size() in interface List sample code for java.util.List definition code for java.util.List <E>
Specified by:
size sample code for java.util.AbstractCollection.size() definition code for java.util.AbstractCollection.size() in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Returns:
the number of components in this vector.

isEmpty sample code for java.util.Vector.isEmpty() definition code for java.util.Vector.isEmpty()

public boolean isEmpty()
Tests if this vector has no components.

Specified by:
isEmpty sample code for java.util.Collection.isEmpty() definition code for java.util.Collection.isEmpty() in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
isEmpty sample code for java.util.List.isEmpty() definition code for java.util.List.isEmpty() in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
isEmpty sample code for java.util.AbstractCollection.isEmpty() definition code for java.util.AbstractCollection.isEmpty() in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Returns:
true if and only if this vector has no components, that is, its size is zero; false otherwise.

elements sample code for java.util.Vector.elements() definition code for java.util.Vector.elements()

public Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <E> elements()
Returns an enumeration of the components of this vector. The returned Enumeration object will generate all items in this vector. The first item generated is the item at index 0, then the item at index 1, and so on.

Returns:
an enumeration of the components of this vector.
See Also:
Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration , Iterator sample code for java.util.Iterator definition code for java.util.Iterator

contains sample code for java.util.Vector.contains(java.lang.Object) definition code for java.util.Vector.contains(java.lang.Object)

public boolean contains(Object sample code for java.lang.Object definition code for java.lang.Object  elem)
Tests if the specified object is a component in this vector.

Specified by:
contains sample code for java.util.Collection.contains(java.lang.Object) definition code for java.util.Collection.contains(java.lang.Object) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
contains sample code for java.util.List.contains(java.lang.Object) definition code for java.util.List.contains(java.lang.Object) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
contains sample code for java.util.AbstractCollection.contains(java.lang.Object) definition code for java.util.AbstractCollection.contains(java.lang.Object) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
elem - an object.
Returns:
true if and only if the specified object is the same as a component in this vector, as determined by the equals method; false otherwise.

indexOf sample code for java.util.Vector.indexOf(java.lang.Object) definition code for java.util.Vector.indexOf(java.lang.Object)

public int indexOf(Object sample code for java.lang.Object definition code for java.lang.Object  elem)
Searches for the first occurence of the given argument, testing for equality using the equals method.

Specified by:
indexOf sample code for java.util.List.indexOf(java.lang.Object) definition code for java.util.List.indexOf(java.lang.Object) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
indexOf sample code for java.util.AbstractList.indexOf(java.lang.Object) definition code for java.util.AbstractList.indexOf(java.lang.Object) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
elem - an object.
Returns:
the index of the first occurrence of the argument in this vector, that is, the smallest value k such that elem.equals(elementData[k]) is true; returns -1 if the object is not found.
See Also:
Object.equals(Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object)

indexOf sample code for java.util.Vector.indexOf(java.lang.Object, int) definition code for java.util.Vector.indexOf(java.lang.Object, int)

public int indexOf(Object sample code for java.lang.Object definition code for java.lang.Object  elem,
                   int index)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.

Parameters:
elem - an object.
index - the non-negative index to start searching from.
Returns:
the index of the first occurrence of the object argument in this vector at position index or later in the vector, that is, the smallest value k such that elem.equals(elementData[k]) && (k >= index) is true; returns -1 if the object is not found. (Returns -1 if index >= the current size of this Vector.)
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if index is negative.
See Also:
Object.equals(Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object)

lastIndexOf sample code for java.util.Vector.lastIndexOf(java.lang.Object) definition code for java.util.Vector.lastIndexOf(java.lang.Object)

public int lastIndexOf(Object sample code for java.lang.Object definition code for java.lang.Object  elem)
Returns the index of the last occurrence of the specified object in this vector.

Specified by:
lastIndexOf sample code for java.util.List.lastIndexOf(java.lang.Object) definition code for java.util.List.lastIndexOf(java.lang.Object) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
lastIndexOf sample code for java.util.AbstractList.lastIndexOf(java.lang.Object) definition code for java.util.AbstractList.lastIndexOf(java.lang.Object) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
elem - the desired component.
Returns:
the index of the last occurrence of the specified object in this vector, that is, the largest value k such that elem.equals(elementData[k]) is true; returns -1 if the object is not found.

lastIndexOf sample code for java.util.Vector.lastIndexOf(java.lang.Object, int) definition code for java.util.Vector.lastIndexOf(java.lang.Object, int)

public int lastIndexOf(Object sample code for java.lang.Object definition code for java.lang.Object  elem,
                       int index)
Searches backwards for the specified object, starting from the specified index, and returns an index to it.

Parameters:
elem - the desired component.
index - the index to start searching from.
Returns:
the index of the last occurrence of the specified object in this vector at position less than or equal to index in the vector, that is, the largest value k such that elem.equals(elementData[k]) && (k <= index) is true; -1 if the object is not found. (Returns -1 if index is negative.)
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if index is greater than or equal to the current size of this vector.

elementAt sample code for java.util.Vector.elementAt(int) definition code for java.util.Vector.elementAt(int)

public E elementAt(int index)
Returns the component at the specified index.

This method is identical in functionality to the get method (which is part of the List interface).

Parameters:
index - an index into this vector.
Returns:
the component at the specified index.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of this Vector object. given.
See Also:
get(int) sample code for java.util.Vector.get(int) definition code for java.util.Vector.get(int) , List sample code for java.util.List definition code for java.util.List

firstElement sample code for java.util.Vector.firstElement() definition code for java.util.Vector.firstElement()

public E firstElement()
Returns the first component (the item at index 0) of this vector.

Returns:
the first component of this vector.
Throws:
NoSuchElementException sample code for java.util.NoSuchElementException definition code for java.util.NoSuchElementException - if this vector has no components.

lastElement sample code for java.util.Vector.lastElement() definition code for java.util.Vector.lastElement()

public E lastElement()
Returns the last component of the vector.

Returns:
the last component of the vector, i.e., the component at index size() - 1.
Throws:
NoSuchElementException sample code for java.util.NoSuchElementException definition code for java.util.NoSuchElementException - if this vector is empty.

setElementAt sample code for java.util.Vector.setElementAt(E, int) definition code for java.util.Vector.setElementAt(E, int)

public void setElementAt(E obj,
                         int index)
Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded.

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

This method is identical in functionality to the set method (which is part of the List interface). Note that the set method reverses the order of the parameters, to more closely match array usage. Note also that the set method returns the old value that was stored at the specified position.

Parameters:
obj - what the component is to be set to.
index - the specified index.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.
See Also:
size() sample code for java.util.Vector.size() definition code for java.util.Vector.size() , List sample code for java.util.List definition code for java.util.List , set(int, java.lang.Object) sample code for java.util.Vector.set(int, E) definition code for java.util.Vector.set(int, E)

removeElementAt sample code for java.util.Vector.removeElementAt(int) definition code for java.util.Vector.removeElementAt(int)

public void removeElementAt(int index)
Deletes the component at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously. The size of this vector is decreased by 1.

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

This method is identical in functionality to the remove method (which is part of the List interface). Note that the remove method returns the old value that was stored at the specified position.

Parameters:
index - the index of the object to remove.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.
See Also:
size() sample code for java.util.Vector.size() definition code for java.util.Vector.size() , remove(int) sample code for java.util.Vector.remove(int) definition code for java.util.Vector.remove(int) , List sample code for java.util.List definition code for java.util.List

insertElementAt sample code for java.util.Vector.insertElementAt(E, int) definition code for java.util.Vector.insertElementAt(E, int)

public void insertElementAt(E obj,
                            int index)
Inserts the specified object as a component in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

The index must be a value greater than or equal to 0 and less than or equal to the current size of the vector. (If the index is equal to the current size of the vector, the new element is appended to the Vector.)

This method is identical in functionality to the add(Object, int) method (which is part of the List interface). Note that the add method reverses the order of the parameters, to more closely match array usage.

Parameters:
obj - the component to insert.
index - where to insert the new component.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.
See Also:
size() sample code for java.util.Vector.size() definition code for java.util.Vector.size() , add(int, Object) sample code for java.util.Vector.add(int, E) definition code for java.util.Vector.add(int, E) , List sample code for java.util.List definition code for java.util.List

addElement sample code for java.util.Vector.addElement(E) definition code for java.util.Vector.addElement(E)

public void addElement(E obj)
Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.

This method is identical in functionality to the add(Object) method (which is part of the List interface).

Parameters:
obj - the component to be added.
See Also:
add(Object) sample code for java.util.Vector.add(E) definition code for java.util.Vector.add(E) , List sample code for java.util.List definition code for java.util.List

removeElement sample code for java.util.Vector.removeElement(java.lang.Object) definition code for java.util.Vector.removeElement(java.lang.Object)

public boolean removeElement(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Removes the first (lowest-indexed) occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.

This method is identical in functionality to the remove(Object) method (which is part of the List interface).

Parameters:
obj - the component to be removed.
Returns:
true if the argument was a component of this vector; false otherwise.
See Also:
List.remove(Object) sample code for java.util.List.remove(java.lang.Object) definition code for java.util.List.remove(java.lang.Object) , List sample code for java.util.List definition code for java.util.List

removeAllElements sample code for java.util.Vector.removeAllElements() definition code for java.util.Vector.removeAllElements()

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

This method is identical in functionality to the clear method (which is part of the List interface).

See Also:
clear() sample code for java.util.Vector.clear() definition code for java.util.Vector.clear() , List sample code for java.util.List definition code for java.util.List

clone sample code for java.util.Vector.clone() definition code for java.util.Vector.clone()

public Object sample code for java.lang.Object definition code for java.lang.Object  clone()
Returns a clone of this vector. The copy will contain a reference to a clone of the internal data array, not a reference to the original internal data array of this Vector object.

Overrides:
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a clone of this vector.
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

toArray sample code for java.util.Vector.toArray() definition code for java.util.Vector.toArray()

public Object sample code for java.lang.Object definition code for java.lang.Object [] toArray()
Returns an array containing all of the elements in this Vector in the correct order.

Specified by:
toArray sample code for java.util.Collection.toArray() definition code for java.util.Collection.toArray() in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
toArray sample code for java.util.List.toArray() definition code for java.util.List.toArray() in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
toArray sample code for java.util.AbstractCollection.toArray() definition code for java.util.AbstractCollection.toArray() in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Returns:
an array containing all of the elements in this collection.
Since:
1.2
See Also:
Arrays.asList(Object[]) sample code for java.util.Arrays.asList(T...) definition code for java.util.Arrays.asList(T...)

toArray sample code for java.util.Vector.<T>toArray(T[]) definition code for java.util.Vector.<T>toArray(T[])

public <T> T[] toArray(T[] a)
Returns an array containing all of the elements in this Vector in the correct order; the runtime type of the returned array is that of the specified array. If the Vector fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this Vector.

If the Vector fits in the specified array with room to spare (i.e., the array has more elements than the Vector), the element in the array immediately following the end of the Vector is set to null. This is useful in determining the length of the Vector only if the caller knows that the Vector does not contain any null elements.

Specified by:
toArray sample code for java.util.Collection.toArray(T[]) definition code for java.util.Collection.toArray(T[]) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
toArray sample code for java.util.List.toArray(T[]) definition code for java.util.List.toArray(T[]) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
toArray sample code for java.util.AbstractCollection.toArray(T[]) definition code for java.util.AbstractCollection.toArray(T[]) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
a - the array into which the elements of the Vector are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
an array containing the elements of the Vector.
Throws:
ArrayStoreException sample code for java.lang.ArrayStoreException definition code for java.lang.ArrayStoreException - the runtime type of a is not a supertype of the runtime type of every element in this Vector.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the given array is null.
Since:
1.2

get sample code for java.util.Vector.get(int) definition code for java.util.Vector.get(int)

public E get(int index)
Returns the element at the specified position in this Vector.

Specified by:
get sample code for java.util.List.get(int) definition code for java.util.List.get(int) in interface List sample code for java.util.List definition code for java.util.List <E>
Specified by:
get sample code for java.util.AbstractList.get(int) definition code for java.util.AbstractList.get(int) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
index - index of element to return.
Returns:
object at the specified index
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - index is out of range (index < 0 || index >= size()).
Since:
1.2

set sample code for java.util.Vector.set(int, E) definition code for java.util.Vector.set(int, E)

public E set(int index,
             E element)
Replaces the element at the specified position in this Vector with the specified element.

Specified by:
set sample code for java.util.List.set(int, E) definition code for java.util.List.set(int, E) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
set sample code for java.util.AbstractList.set(int, E) definition code for java.util.AbstractList.set(int, E) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
index - index of element to replace.
element - element to be stored at the specified position.
Returns:
the element previously at the specified position.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - index out of range (index < 0 || index >= size()).
Since:
1.2

add sample code for java.util.Vector.add(E) definition code for java.util.Vector.add(E)

public boolean add(E o)
Appends the specified element to the end of this Vector.

Specified by:
add sample code for java.util.Collection.add(E) definition code for java.util.Collection.add(E) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
add sample code for java.util.List.add(E) definition code for java.util.List.add(E) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
add sample code for java.util.AbstractList.add(E) definition code for java.util.AbstractList.add(E) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
o - element to be appended to this Vector.
Returns:
true (as per the general contract of Collection.add).
Since:
1.2

remove sample code for java.util.Vector.remove(java.lang.Object) definition code for java.util.Vector.remove(java.lang.Object)

public boolean remove(Object sample code for java.lang.Object definition code for java.lang.Object  o)
Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists).

Specified by:
remove sample code for java.util.Collection.remove(java.lang.Object) definition code for java.util.Collection.remove(java.lang.Object) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
remove sample code for java.util.List.remove(java.lang.Object) definition code for java.util.List.remove(java.lang.Object) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
remove sample code for java.util.AbstractCollection.remove(java.lang.Object) definition code for java.util.AbstractCollection.remove(java.lang.Object) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
o - element to be removed from this Vector, if present.
Returns:
true if the Vector contained the specified element.
Since:
1.2

add sample code for java.util.Vector.add(int, E) definition code for java.util.Vector.add(int, E)

public void add(int index,
                E element)
Inserts the specified element at the specified position in this Vector. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Specified by:
add sample code for java.util.List.add(int, E) definition code for java.util.List.add(int, E) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
add sample code for java.util.AbstractList.add(int, E) definition code for java.util.AbstractList.add(int, E) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
index - index at which the specified element is to be inserted.
element - element to be inserted.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - index is out of range (index < 0 || index > size()).
Since:
1.2

remove sample code for java.util.Vector.remove(int) definition code for java.util.Vector.remove(int)

public E remove(int index)
Removes the element at the specified position in this Vector. shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the Vector.

Specified by:
remove sample code for java.util.List.remove(int) definition code for java.util.List.remove(int) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
remove sample code for java.util.AbstractList.remove(int) definition code for java.util.AbstractList.remove(int) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
index - the index of the element to removed.
Returns:
element that was removed
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - index out of range (index < 0 || index >= size()).
Since:
1.2

clear sample code for java.util.Vector.clear() definition code for java.util.Vector.clear()

public void clear()
Removes all of the elements from this Vector. The Vector will be empty after this call returns (unless it throws an exception).

Specified by:
clear sample code for java.util.Collection.clear() definition code for java.util.Collection.clear() in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
clear sample code for java.util.List.clear() definition code for java.util.List.clear() in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
clear sample code for java.util.AbstractList.clear() definition code for java.util.AbstractList.clear() in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Since:
1.2

containsAll sample code for java.util.Vector.containsAll(java.util.Collection<?>) definition code for java.util.Vector.containsAll(java.util.Collection<?>)

public boolean containsAll(Collection sample code for java.util.Collection definition code for java.util.Collection <?> c)
Returns true if this Vector contains all of the elements in the specified Collection.

Specified by:
containsAll sample code for java.util.Collection.containsAll(java.util.Collection) definition code for java.util.Collection.containsAll(java.util.Collection) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
containsAll sample code for java.util.List.containsAll(java.util.Collection) definition code for java.util.List.containsAll(java.util.Collection) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
containsAll sample code for java.util.AbstractCollection.containsAll(java.util.Collection) definition code for java.util.AbstractCollection.containsAll(java.util.Collection) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
c - a collection whose elements will be tested for containment in this Vector
Returns:
true if this Vector contains all of the elements in the specified collection.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the specified collection is null.
See Also:
AbstractCollection.contains(Object) sample code for java.util.AbstractCollection.contains(java.lang.Object) definition code for java.util.AbstractCollection.contains(java.lang.Object)

addAll sample code for java.util.Vector.addAll(java.util.Collection<? extends E>) definition code for java.util.Vector.addAll(java.util.Collection<? extends E>)

public boolean addAll(Collection sample code for java.util.Collection definition code for java.util.Collection <? extends E> c)
Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this Vector, and this Vector is nonempty.)

Specified by:
addAll sample code for java.util.Collection.addAll(java.util.Collection) definition code for java.util.Collection.addAll(java.util.Collection) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
addAll sample code for java.util.List.addAll(java.util.Collection) definition code for java.util.List.addAll(java.util.Collection) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
addAll sample code for java.util.AbstractCollection.addAll(java.util.Collection) definition code for java.util.AbstractCollection.addAll(java.util.Collection) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
c - elements to be inserted into this Vector.
Returns:
true if this Vector changed as a result of the call.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the specified collection is null.
Since:
1.2
See Also:
AbstractCollection.add(Object) sample code for java.util.AbstractCollection.add(E) definition code for java.util.AbstractCollection.add(E)

removeAll sample code for java.util.Vector.removeAll(java.util.Collection<?>) definition code for java.util.Vector.removeAll(java.util.Collection<?>)

public boolean removeAll(Collection sample code for java.util.Collection definition code for java.util.Collection <?> c)
Removes from this Vector all of its elements that are contained in the specified Collection.

Specified by:
removeAll sample code for java.util.Collection.removeAll(java.util.Collection) definition code for java.util.Collection.removeAll(java.util.Collection) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
removeAll sample code for java.util.List.removeAll(java.util.Collection) definition code for java.util.List.removeAll(java.util.Collection) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
removeAll sample code for java.util.AbstractCollection.removeAll(java.util.Collection) definition code for java.util.AbstractCollection.removeAll(java.util.Collection) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
c - a collection of elements to be removed from the Vector
Returns:
true if this Vector changed as a result of the call.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the specified collection is null.
Since:
1.2
See Also:
AbstractCollection.remove(Object) sample code for java.util.AbstractCollection.remove(java.lang.Object) definition code for java.util.AbstractCollection.remove(java.lang.Object) , AbstractCollection.contains(Object) sample code for java.util.AbstractCollection.contains(java.lang.Object) definition code for java.util.AbstractCollection.contains(java.lang.Object)

retainAll sample code for java.util.Vector.retainAll(java.util.Collection<?>) definition code for java.util.Vector.retainAll(java.util.Collection<?>)

public boolean retainAll(Collection sample code for java.util.Collection definition code for java.util.Collection <?> c)
Retains only the elements in this Vector that are contained in the specified Collection. In other words, removes from this Vector all of its elements that are not contained in the specified Collection.

Specified by:
retainAll sample code for java.util.Collection.retainAll(java.util.Collection) definition code for java.util.Collection.retainAll(java.util.Collection) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
retainAll sample code for java.util.List.retainAll(java.util.Collection) definition code for java.util.List.retainAll(java.util.Collection) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
retainAll sample code for java.util.AbstractCollection.retainAll(java.util.Collection) definition code for java.util.AbstractCollection.retainAll(java.util.Collection) in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Parameters:
c - a collection of elements to be retained in this Vector (all other elements are removed)
Returns:
true if this Vector changed as a result of the call.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the specified collection is null.
Since:
1.2
See Also:
AbstractCollection.remove(Object) sample code for java.util.AbstractCollection.remove(java.lang.Object) definition code for java.util.AbstractCollection.remove(java.lang.Object) , AbstractCollection.contains(Object) sample code for java.util.AbstractCollection.contains(java.lang.Object) definition code for java.util.AbstractCollection.contains(java.lang.Object)

addAll sample code for java.util.Vector.addAll(int, java.util.Collection<? extends E>) definition code for java.util.Vector.addAll(int, java.util.Collection<? extends E>)

public boolean addAll(int index,
                      Collection sample code for java.util.Collection definition code for java.util.Collection <? extends E> c)
Inserts all of the elements in the specified Collection into this Vector at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the Vector in the order that they are returned by the specified Collection's iterator.

Specified by:
addAll sample code for java.util.List.addAll(int, java.util.Collection) definition code for java.util.List.addAll(int, java.util.Collection) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
addAll sample code for java.util.AbstractList.addAll(int, java.util.Collection) definition code for java.util.AbstractList.addAll(int, java.util.Collection) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
index - index at which to insert first element from the specified collection.
c - elements to be inserted into this Vector.
Returns:
true if this Vector changed as a result of the call.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - index out of range (index < 0 || index > size()).
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the specified collection is null.
Since:
1.2

equals sample code for java.util.Vector.equals(java.lang.Object) definition code for java.util.Vector.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  o)
Compares the specified Object with this Vector for equality. Returns true if and only if the specified Object is also a List, both Lists have the same size, and all corresponding pairs of elements in the two Lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two Lists are defined to be equal if they contain the same elements in the same order.

Specified by:
equals sample code for java.util.Collection.equals(java.lang.Object) definition code for java.util.Collection.equals(java.lang.Object) in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
equals sample code for java.util.List.equals(java.lang.Object) definition code for java.util.List.equals(java.lang.Object) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
equals sample code for java.util.AbstractList.equals(java.lang.Object) definition code for java.util.AbstractList.equals(java.lang.Object) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
o - the Object to be compared for equality with this Vector.
Returns:
true if the specified Object is equal to this Vector
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for java.util.Vector.hashCode() definition code for java.util.Vector.hashCode()

public int hashCode()
Returns the hash code value for this Vector.

Specified by:
hashCode sample code for java.util.Collection.hashCode() definition code for java.util.Collection.hashCode() in interface Collection sample code for java.util.Collection definition code for java.util.Collection <E>
Specified by:
hashCode sample code for java.util.List.hashCode() definition code for java.util.List.hashCode() in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
hashCode sample code for java.util.AbstractList.hashCode() definition code for java.util.AbstractList.hashCode() in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Returns:
the hash code value for this list.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for java.util.Vector.toString() definition code for java.util.Vector.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string representation of this Vector, containing the String representation of each element.

Overrides:
toString sample code for java.util.AbstractCollection.toString() definition code for java.util.AbstractCollection.toString() in class AbstractCollection sample code for java.util.AbstractCollection definition code for java.util.AbstractCollection <E>
Returns:
a string representation of this collection.

subList sample code for java.util.Vector.subList(int, int) definition code for java.util.Vector.subList(int, int)

public List sample code for java.util.List definition code for java.util.List <E> subList(int fromIndex,
                       int toIndex)
Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and ToIndex are equal, the returned List is empty.) The returned List is backed by this List, so changes in the returned List are reflected in this List, and vice-versa. The returned List supports all of the optional List operations supported by this List.

This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a List can be used as a range operation by operating on a subList view instead of a whole List. For example, the following idiom removes a range of elements from a List:

            list.subList(from, to).clear();
 
Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList.

The semantics of the List returned by this method become undefined if the backing list (i.e., this List) is structurally modified in any way other than via the returned List. (Structural modifications are those that change the size of the List, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)

Specified by:
subList sample code for java.util.List.subList(int, int) definition code for java.util.List.subList(int, int) in interface List sample code for java.util.List definition code for java.util.List <E>
Overrides:
subList sample code for java.util.AbstractList.subList(int, int) definition code for java.util.AbstractList.subList(int, int) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
fromIndex - low endpoint (inclusive) of the subList.
toIndex - high endpoint (exclusive) of the subList.
Returns:
a view of the specified range within this List.
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - endpoint index value out of range (fromIndex < 0 || toIndex > size)
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - endpoint indices out of order (fromIndex > toIndex)

removeRange sample code for java.util.Vector.removeRange(int, int) definition code for java.util.Vector.removeRange(int, int)

protected void removeRange(int fromIndex,
                           int toIndex)
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the ArrayList by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)

Overrides:
removeRange sample code for java.util.AbstractList.removeRange(int, int) definition code for java.util.AbstractList.removeRange(int, int) in class AbstractList sample code for java.util.AbstractList definition code for java.util.AbstractList <E>
Parameters:
fromIndex - index of first element to be removed.
toIndex - index after last element to be removed.