Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
1) Object get(int index)
Returns the element at the specified index in the Vector.
Note : We need to downcast the returned object to the desired type.
2) Object firstElement()
Returns the first element of the Vector (i.e. at index 0)
3) Object lastElement()
Returns the last element of the Vector (i.e. at index size - 1)
Remove elements from the Vector
1) Object remove(int index)
Removes the elements at the specified index in the Vector and shifts the subsequent element of the list by one. This method returns the element that has been removed from the Vector. This method can throw IndexOutOfBoundException if the index specified is out of range.
2) void removeElementAt (int index)
Removes the elements at the specified index in the Vector and shifts the subsequent element of the list by one. This method can throw ArrayIndexOutOfBoundException if the index specified is out of range.
3) boolean remove (Object object)
Removes the first occurrence of the specified Object from the Vector if found. Returns true if the object is remove from the Vector, otherwise returns false.
4) boolean removeElement (Object object)
Removes the first occurrence of the specified Object from the Vector if found. Returns true if the object is remove from the Vector, otherwise returns false.
5) boolean remove (Collection collection)
Remove all elements of the Vector which are found in the Collection specified. Returns true if the Vector is changed, otherwise returns false. This method can throw NullPointerException if the specified Collection is null.
6) void removeRange(int startIndex, int endIndex)
Removes the elements from Vector whose index is between startIndex inclusive and endIndex exclusive and shifts the subsequent elements of the Vector.
7) void clear()
Removes all elements of the Vector.
8) void removeAllElements()
Removes all elements of the Vector.
Convert Vector to an Object array
1) Object[] toarray()
Returns array of Object containing all elements of the Vector in the correct order.
This brings us end of Java Vector Tutorial. Please let us know your views by leaving a comment in comments section below.
<< Java Vector Add Replace Elements Java Vector Example >>

Good overview
Post new comment