Search This Blog

Thursday, August 03, 2006

why the Java Vector class is called a "Vector"?

"Vector" is a common name for an array of one dimension.
I think that it was designed to be accessed in only one direction - from start to end. Of course, you can write code to iterate backwards...
But the enumeration it goes you don't have a getPrev() method, only a getNext():
for (Enumeration e = v.elements() ;
e.hasMoreElements() {
System.out.println(e.nextElement());
}
So a Vector has dimension (number of elements) and direction (in terms of access).

2 comments:

Jayaprabhakar said...

A Nice article javapeople!

Have a look at the comparison of ArrayList and Vector and when to use what.

http://skeletoncoder.blogspot.com/2006/09/java-tutorials-arraylist-or-vector.html

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!