Home Tutorial Java Iterator Java Vector Iterator


Share on Google+Share on Google+
Java Vector Iterator
Posted on: November 4, 2009 at 12:00 AM
In this segment of tutorial we will learn about the Vector class and its use with the Iterator interface.Then We will create an example to print the content of the a Vector.

  • Java Vector Iterator is a Collection class. It has similar functionality as of the Array.
  • Its size is variable
  • It has growable array. Its size may increase or decrease.
  • It has iterator() method. So Iterator interface can traverse all its elements.

Java Vector Iterator Example
import java.util.Iterator;
import java.util.Vector;

public class vector1 {

	public static void main(String[] args) {
		Vector v = new Vector();
		String tree[] = { "olive", "oak", "grass", "mango" };
		for (String s : tree) {
		Iterator it = v.iterator();
		for (; it.hasNext();)


olive oak grass mango

Related Tags for Java Vector Iterator :

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 4, 2009

Recommend the tutorial

Advertisements Advertisements