Java Utility Library

Java.util.Dictionary Class



Java Dictionary Class

Java.util package provides a Dictionary class which is the abstract parent of any class, such as Hashtable, which maps keys to values. Every key and every value is an object. In any one Dictionary object, every key is associated with at most one value. Given a Dictionary and a key, the associated element can be looked up. Any non-null object can be used as a key and as a value.

Class declaration

The declaration of java.util.Dictionary class is:

public abstract class Dictionary<K,V>
  extends Object

Class Constructor

S.NConstructors & Description
1. Dictionary()
Sole constructor.

java.util.Dictionary Methods

The java.util.Dictionary class has a number of methods which are listed below:

Member Methods

S.NMethods & Description
1. abstract Enumeration<V> elements()
Returns an enumeration of the values in this dictionary.
2. abstract V get(Object key)
Returns the value to which the key is mapped in this dictionary.
3. abstract boolean isEmpty()
Tests if this dictionary maps no keys to value.
4. abstract Enumeration<K> keys()
Returns an enumeration of the keys in this dictionary.
5. abstract V put(K key, V value)
Maps the specified key to the specified value in this dictionary.
6. abstract V remove(Object key)
Removes the key (and its corresponding value) from this dictionary.
7. abstract int size()
Returns the number of entries (distinct keys) in this dictionary.

Methods inherited

This class inherits the methods of following class:

  • java.lang.Object