java.util

Class Dictionary<K,V>

Known Direct Subclasses:
Hashtable<K,V>

public abstract class Dictionary<K,V>
extends Object

The Dictionary class 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.

As a rule, the equals method should be used by implementations of this class to decide if two keys are the same.

NOTE: This class is obsolete. New implementations should implement the Map interface, rather than extending this class.

Since:
JDK1.0
See Also:
Map, Object.equals(Object), Object.hashCode(), Hashtable

Constructor Summary

Dictionary()
Sole constructor.

Method Summary

abstract Enumeration
elements()
Returns an enumeration of the values in this dictionary.
abstract V
get(Object key)
Returns the value to which the key is mapped in this dictionary.
abstract boolean
isEmpty()
Tests if this dictionary maps no keys to value.
abstract Enumeration
keys()
Returns an enumeration of the keys in this dictionary.
abstract V
put(K key, V value)
Maps the specified key to the specified value in this dictionary.
abstract V
remove(Object key)
Removes the key (and its corresponding value) from this dictionary.
abstract int
size()
Returns the number of entries (distinct keys) in this dictionary.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

Dictionary

public Dictionary()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Details

elements

public abstract Enumeration elements()
Returns an enumeration of the values in this dictionary. The general contract for the elements method is that an Enumeration is returned that will generate all the elements contained in entries in this dictionary.
Returns:
an enumeration of the values in this dictionary.
Usages and Demos :

View More Examples of elements()
   1: import java.awt.Font;
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5:             
   6:             Dictionary labeldict = this.getLabelTable();
   7:         ...
   8:             Enumeration labels = labeldict.elements();
   9:             while ( labels.hasMoreElements() )

View Full Code Here
   1: import java.util.Enumeration;
   2: import java.util.Dictionary;
   3: import java.util.Hashtable;
   4:         ...
   5:     private ClassFileFinder finder;
   6:     private Dictionary        nodeDictionary;
   7: 
   8:         ...
   9: 
  10:     public Enumeration allNodes() { return nodeDictionary.elements(); }

View Full Code Here
   1:     public Enumeration  subclasses(){
   2:     return (subclassSet == null ) ? EmptyEnumeration.instance : subclassSet.elements();
   3:     }
   4:         ...
   5:     public Enumeration    members(){
   6:     return (memberSet == null ) ? EmptyEnumeration.instance : memberSet.elements();
   7:     }
   8:         ...
   9:     public Enumeration interfaces(){
  10:     return (interfaceSet == null ) ? EmptyEnumeration.instance : interfaceSet.elements();
  11:     }
  12:         ...
  13:     private Vector    subclassSet;
  14:     private Dictionary    memberSet;

View Full Code Here
   1: import java.io.RandomAccessFile;
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: 
   6:         Dictionary d = QduSlider.getLabelTable();
   7:         ...
   8:         Enumeration e = d.elements();
   9:         while (e.hasMoreElements()) {
  10:         ...
  11:         d = QprSlider.getLabelTable();
  12:         e = d.elements();

View Full Code Here
   1: import java.io.Serializable;
   2: import jp.ujihara.java.util.Dictionary;
   3: import jp.ujihara.java.util.Enumeration;
   4:         ...
   5: 
   6:   private transient Dictionary labelTable;
   7: 
   8:         ...
   9: 
  10:   public Dictionary getLabelTable()
  11:   {
  12:         ...
  13:       return;
  14:     for (Enumeration list = labelTable.elements(); list.hasMoreElements();)

View Full Code Here

get

public abstract V get(Object key)
Returns the value to which the key is mapped in this dictionary. The general contract for the isEmpty method is that if this dictionary contains an entry for the specified key, the associated value is returned; otherwise, null is returned.
Parameters:
key - a key in this dictionary. null if the key is not mapped to any value in this dictionary.
Returns:
the value to which the key is mapped in this dictionary;
Throws:
NullPointerException - if the key is null.
See Also:
java.util.Dictionary.put(java.lang.Object, java.lang.Object)
Usages and Demos :

View More Examples of get(Object key)
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Hashtable;
   4:         ...
   5: 
   6:   private Dictionary defaults;
   7: 
   8:         ...
   9:   public PropertySet(Dictionary defaults)
  10:   {
  11:         ...
  12:       return put(key, value);
  13:     else if ((m = mappers.get(key)) instanceof Mapper)

View Full Code Here
   1:              ArrayDictionary parameters,
   2:              Dictionary variables)
   3:     {
   4:         ...
   5:     
   6:     Dictionary ssiVars = (Dictionary)
   7:         ...
   8:         variables.get( parameters.get("here") == null
   9:                ? "topSsiVars"
  10:         ...
  11:     String sizefmt = (String)
  12:         variables.get("sizefmt") ;

View Full Code Here
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     public Dictionary backing;
   7: 
   8:         ...
   9:     {
  10:          return ( backing.get(name) ) != null;
  11:     }
  12:         ...
  13:     {
  14:         return backing.get(name);

View Full Code Here
   1:              ArrayDictionary parameters,
   2:              Dictionary variables)
   3:     {        
   4:         ...
   5:     String cmd = (String) parameters.get("cmd") ;
   6:     if(cmd != null) return executeCmd(ssiframe,
   7:         ...
   8:                  ArrayDictionary parameters,
   9:                  Dictionary variables,
  10:                  String cmd)
  11:         ...
  12:     {
  13:     if(((Boolean)variables.get("secure")).booleanValue()) {

View Full Code Here
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Hashtable;
   4:         ...
   5:         Hashtable properties = new Hashtable(7);
   6:         Dictionary headers = bundle.getHeaders();
   7:         ...
   8:         properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR));
   9:         properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE));

View Full Code Here

isEmpty

public abstract boolean isEmpty()
Tests if this dictionary maps no keys to value. The general contract for the isEmpty method is that the result is true if and only if this dictionary contains no entries.
Returns:
true if this dictionary maps no keys to values; false otherwise.
Usages and Demos :

View More Examples of isEmpty()
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     public Dictionary backing;
   7: 
   8:         ...
   9:     {
  10:          return backing.isEmpty();
  11:     }

View Full Code Here

keys

public abstract Enumeration keys()
Returns an enumeration of the keys in this dictionary. The general contract for the keys method is that an Enumeration object is returned that will generate all the keys for which this dictionary contains entries.
Returns:
an enumeration of the keys in this dictionary.
Usages and Demos :

View More Examples of keys()
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     public Dictionary backing;
   7: 
   8:         ...
   9:     {
  10:          return backing.keys();
  11:     }

View Full Code Here
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: 
   6:     public void updated(Dictionary properties) throws ConfigurationException {
   7:         if (properties != null) {
   8:         ...
   9:             for (Enumeration e = properties.keys(); e.hasMoreElements();) {
  10:                 String key = (String) e.nextElement();

View Full Code Here
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: 
   6:     public static boolean equals(Dictionary d1, Dictionary d2) {
   7:         if (d1 == d2) {
   8:         ...
   9: 
  10:         Enumeration e1 = d1.keys();
  11:         while (e1.hasMoreElements()) {
  12:         ...
  13:     public static void putAll(Dictionary m1, Dictionary m2) {
  14:         for (Enumeration it = m2.keys(); it.hasMoreElements();) {

View Full Code Here
   1: 
   2:     public Event(String topic, Dictionary properties) {
   3:         this.topic = topic;
   4:         ...
   5:         if (properties != null) {
   6:             for (Enumeration e = properties.keys(); e.hasMoreElements();) {
   7:                 String key = (String) e.nextElement();
   8:         ...
   9:         String[] names = new String[properties.size()];
  10:         Enumeration keys = properties.keys();
  11:         for (int i = 0; keys.hasMoreElements(); i++) {

View Full Code Here
   1: 
   2:   public static Vector dictionaryToVector(Dictionary dict)
   3:   {
   4:         ...
   5:     Vector v = new Vector();
   6:     Enumeration keys = dict.keys();
   7:     while (keys.hasMoreElements()) {
   8:         ...
   9:       Object val = dict.get(key);
  10:       if (val instanceof Dictionary)
  11:       Vector pair = new Vector();

View Full Code Here

put

public abstract V put(K key,
                      V value)
Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null.

If this dictionary already contains an entry for the specified key, the value already in this dictionary for that key is returned, after modifying the entry to contain the new element.

If this dictionary does not already have an entry for the specified key, an entry is created for the specified key and value, and null is returned.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the hashtable key.
value - the value.
Returns:
the previous value to which the key was mapped in this dictionary, or null if the key did not have a previous mapping.
Throws:
NullPointerException - if the key or value is null.
Usages and Demos :

View More Examples of put(K key,V value)
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Hashtable;
   4:         ...
   5:     public static void start(String webappName) throws CoreException {
   6:         Dictionary d = new Hashtable();
   7:         
   8: 
   9:         

View Full Code Here
   1: 
   2:     public Dictionary initVariables(SSIFrame ssiframe,
   3:                     Request request,
   4:         ...
   5:                     Dictionary variables)
   6:     {
   7:         ...
   8:     if(hval != null)
   9:         ssiVars.put("HTTP_ACCEPT",hval.toExternalForm()) ;
  10:     
  11:         ...
  12: 
  13:     variables.put("ssiVars",ssiVars) ;

View Full Code Here
   1:     private boolean isConfigError(BundleDescription bundle, ResolverError[] errors, List configs) {
   2:         Dictionary environment = new Hashtable(3);
   3:         String filterSpec = bundle.getPlatformFilter();
   4:         if (hasPlatformFilterError(errors) != null) {
   5:             for (Iterator iter = configs.iterator(); iter.hasNext();) {

View Full Code Here
   1:         } else {
   2:             Dictionary environment = new Hashtable(3);
   3: 
   4:         ...
   5: 
   6:         Dictionary environment = new Hashtable(4);
   7: 
   8:         PDEState state = getSite(false).getRegistry();
   9:         BundleHelper helper = BundleHelper.getDefault();

View Full Code Here
   1:     
   2:     protected Dictionary bundleProperties;
   3:     
   4:         ...
   5:                     seencomma = true;
   6:     private Dictionary getProperties() {
   7:         if (bundleProperties == null) {
   8:             bundleProperties = new Hashtable();

View Full Code Here

remove

public abstract V remove(Object key)
Removes the key (and its corresponding value) from this dictionary. This method does nothing if the key is not in this dictionary.
Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this dictionary, or null if the key did not have a mapping.
Throws:
NullPointerException - if key is null.
Usages and Demos :

View More Examples of remove(Object key)
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     public Dictionary backing;
   7: 
   8:         ...
   9:     {
  10:         backing.remove(name);
  11:     }

View Full Code Here
   1: { 
   2:     static Dictionary dictionary = new Hashtable(); 
   3:     
   4:         ...
   5:                 
   6:                 Object o[] = (Object [])dictionary.get( mouseEvtComp ); 
   7:                 
   8:         ...
   9:         
  10:     public static void removePopup( JComponent mouseEvtComp ) { dictionary.remove( mouseEvtComp ); } 
  11: }

View Full Code Here
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Hashtable;
   4:         ...
   5:   private URL service;
   6:   private Dictionary options;
   7:         ...
   8:   private Dictionary ratings;
   9: 
  10:         ...
  11:   {
  12:     return options.remove(name);

View Full Code Here
   1:     public Object getAttribute(String attributeName) {
   2:         Dictionary attributes = proxyContext.getContextAttributes(httpContext);
   3:         return attributes.get(attributeName);
   4:         ...
   5:     public Enumeration getAttributeNames() {
   6:         Dictionary attributes = proxyContext.getContextAttributes(httpContext);
   7:         return attributes.keys();
   8:         ...
   9:     public void setAttribute(String attributeName, Object attributeValue) {
  10:         Dictionary attributes = proxyContext.getContextAttributes(httpContext);
  11:         attributes.put(attributeName, attributeValue);
  12:         ...
  13:         Dictionary attributes = proxyContext.getContextAttributes(httpContext);
  14:         attributes.remove(attributeName);

View Full Code Here
   1:   Destination rtfDestination;
   2:   Dictionary fontTable;
   3:   Style[] characterStyles;
   4:         ...
   5: 
   6:   static private Dictionary straightforwardAttributes;
   7:   static {
   8:         ...
   9: 
  10:   static Dictionary textKeywords = null;
  11:   static {
  12:         ...
  13:     if (oldSaveState != null)
  14:     parserState.remove("_savedState");

View Full Code Here

size

public abstract int size()
Returns the number of entries (distinct keys) in this dictionary.
Returns:
the number of keys in this dictionary.
Usages and Demos :

View More Examples of size()
   1: 
   2: import java.util.Dictionary;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     public Dictionary backing;
   7: 
   8:         ...
   9:     {
  10:          return backing.size();
  11:     }

View Full Code Here
   1: import java.util.List;
   2: import java.util.Dictionary;
   3: 
   4:         ...
   5:                 if ((savePoints != null) && !savePoints.empty()) {
   6:                     for (int i = savePoints.size() - 1; i >= 0; i--) {
   7: 
   8:         ...
   9: 
  10:                 if (savePoints.size() > 20)
  11:         ...
  12:                     System.out.println("memoryLeakTrace:Xact:savepoints " + savePoints.size());

View Full Code Here