Skip to main content
IBM 
ShopSupportDownloads
IBM HomeProductsConsultingIndustriesNewsAbout IBM
IBM : developerWorks : Java : Education - online courses
Java Collections Framework
Download tutorial zip fileView letter-sized PDF fileView A4-sized PDF fileE-mail this tutorial to a friend
Main menuSection menuGive feedback on this tutorialPreviousNext
5. Historical collection classes
  


Dictionary, Hashtable, and Properties classes page 5 of 7


The Dictionary class is completely full of abstract methods. In other words, it should have been an interface. It forms the basis for key-value pair collections in the historical collection classes, with its replacement being Map in the new framework. Hashtable and Properties are the two specific implementations of Dictionary available.

The Hashtable implementation is a generic dictionary that permits storing any object as its key or value (besides null). With the Java 2 SDK, version 1.2, the class has been reworked into the Collections Framework to implement the Map interface. So you can use the original Hashtable methods or the newer Map methods. If you need a synchronized Map, using Hashtable is slightly faster than using a synchronized HashMap.

The Properties implementation is a specialized Hashtable for working with text strings. While you have to cast values retrieved from a Hashtable to your desired class, the Properties class allows you to get text values without casting. The class also supports loading and saving property settings from an input stream or to an output stream. The most commonly used set of properties is the system properties list, retrieved by System.getProperties().


Main menuSection menuGive feedback on this tutorialPreviousNext
PrivacyLegalContact