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.
Vector provides following methods to search a particular element within the Vector.
1) int indexOf(Object element)
Search for a particular element in the Vector and return the position of the first occurrence of the element if found within the Vector, otherwise returns -1.
2) int indexOf(Object element, int startIndex)
Search for a particular element in the Vector staring from the startIndex specified and return the position of the first occurrence of the element if found within the Vector, otherwise returns -1.
3) int lastIndexOf(Object element)
Search for a particular element in the Vector and return the position of the last occurrence of the element if found within the Vector, otherwise returns -1.
4) int lastIndexOf(Object element, int startIndex)
Search for a particular element in the Vector starting from startIndex in backward direction and returns the position of the last occurrence of the element if found within the Vector, otherwise returns -1.
5) int size()
Returns the number of elements contained in the Vector.
6) boolean isEmpty()
Returns true of the Vector is empty, otherwise returns false.
7) boolean contains(Object element)
Returns true if the specified element is found in the Vector, otherwise returns false.
<< Java Vector Constructors Java Vector Add Replace Elements >>

Post new comment