Sunday, March 21, 2010

Why Vector and Hashtable violate the naming convention specified by Java Collection Framework?

Vector and Hashtable were introduced in JDK 1.0 .
The Java Collections Framework was introduced with JDK 1.2.
Due to backward compatiblity issues the names of Vector and Hashtable could not be changed.

Therefore the "table" portion of Hashtable could not have the "t" changed to uppercase "T." In fact, there is a naming convention for implementations and interfaces in the Java Collection Framework and neither Hashtable nor Vector could be changed to meet this convention. Most implementations in the Java Collections Framework (such as ArrayList, HashMap, and TreeSet) have their name formed from an implementation detail as the first portion of the name and having the name end with the interface implemented.

However the Vector and Hashtable classes were retrofitted to be part of this new Java Collections Framework and, as part of this, to implement interfaces from that framework. Vector was altered to implement List . Simmilarly Hashtable was altered to implement Map

No comments:

Post a Comment