0N/A/*
2362N/A * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.util;
0N/A
0N/A/**
0N/A * The <code>Dictionary</code> class is the abstract parent of any
0N/A * class, such as <code>Hashtable</code>, which maps keys to values.
0N/A * Every key and every value is an object. In any one <tt>Dictionary</tt>
0N/A * object, every key is associated with at most one value. Given a
0N/A * <tt>Dictionary</tt> and a key, the associated element can be looked up.
0N/A * Any non-<code>null</code> object can be used as a key and as a value.
0N/A * <p>
0N/A * As a rule, the <code>equals</code> method should be used by
0N/A * implementations of this class to decide if two keys are the same.
0N/A * <p>
0N/A * <strong>NOTE: This class is obsolete. New implementations should
0N/A * implement the Map interface, rather than extending this class.</strong>
0N/A *
0N/A * @author unascribed
0N/A * @see java.util.Map
0N/A * @see java.lang.Object#equals(java.lang.Object)
0N/A * @see java.lang.Object#hashCode()
0N/A * @see java.util.Hashtable
0N/A * @since JDK1.0
0N/A */
0N/Apublic abstract
0N/Aclass Dictionary<K,V> {
0N/A /**
0N/A * Sole constructor. (For invocation by subclass constructors, typically
0N/A * implicit.)
0N/A */
0N/A public Dictionary() {
0N/A }
0N/A
0N/A /**
0N/A * Returns the number of entries (distinct keys) in this dictionary.
0N/A *
0N/A * @return the number of keys in this dictionary.
0N/A */
0N/A abstract public int size();
0N/A
0N/A /**
0N/A * Tests if this dictionary maps no keys to value. The general contract
0N/A * for the <tt>isEmpty</tt> method is that the result is true if and only
0N/A * if this dictionary contains no entries.
0N/A *
0N/A * @return <code>true</code> if this dictionary maps no keys to values;
0N/A * <code>false</code> otherwise.
0N/A */
0N/A abstract public boolean isEmpty();
0N/A
0N/A /**
0N/A * Returns an enumeration of the keys in this dictionary. The general
0N/A * contract for the keys method is that an <tt>Enumeration</tt> object
0N/A * is returned that will generate all the keys for which this dictionary
0N/A * contains entries.
0N/A *
0N/A * @return an enumeration of the keys in this dictionary.
0N/A * @see java.util.Dictionary#elements()
0N/A * @see java.util.Enumeration
0N/A */
0N/A abstract public Enumeration<K> keys();
0N/A
0N/A /**
0N/A * Returns an enumeration of the values in this dictionary. The general
0N/A * contract for the <tt>elements</tt> method is that an
0N/A * <tt>Enumeration</tt> is returned that will generate all the elements
0N/A * contained in entries in this dictionary.
0N/A *
0N/A * @return an enumeration of the values in this dictionary.
0N/A * @see java.util.Dictionary#keys()
0N/A * @see java.util.Enumeration
0N/A */
0N/A abstract public Enumeration<V> elements();
0N/A
0N/A /**
0N/A * Returns the value to which the key is mapped in this dictionary.
0N/A * The general contract for the <tt>isEmpty</tt> method is that if this
0N/A * dictionary contains an entry for the specified key, the associated
0N/A * value is returned; otherwise, <tt>null</tt> is returned.
0N/A *
0N/A * @return the value to which the key is mapped in this dictionary;
0N/A * @param key a key in this dictionary.
0N/A * <code>null</code> if the key is not mapped to any value in
0N/A * this dictionary.
0N/A * @exception NullPointerException if the <tt>key</tt> is <tt>null</tt>.
0N/A * @see java.util.Dictionary#put(java.lang.Object, java.lang.Object)
0N/A */
0N/A abstract public V get(Object key);
0N/A
0N/A /**
0N/A * Maps the specified <code>key</code> to the specified
0N/A * <code>value</code> in this dictionary. Neither the key nor the
0N/A * value can be <code>null</code>.
0N/A * <p>
0N/A * If this dictionary already contains an entry for the specified
0N/A * <tt>key</tt>, the value already in this dictionary for that
0N/A * <tt>key</tt> is returned, after modifying the entry to contain the
0N/A * new element. <p>If this dictionary does not already have an entry
0N/A * for the specified <tt>key</tt>, an entry is created for the
0N/A * specified <tt>key</tt> and <tt>value</tt>, and <tt>null</tt> is
0N/A * returned.
0N/A * <p>
0N/A * The <code>value</code> can be retrieved by calling the
0N/A * <code>get</code> method with a <code>key</code> that is equal to
0N/A * the original <code>key</code>.
0N/A *
0N/A * @param key the hashtable key.
0N/A * @param value the value.
0N/A * @return the previous value to which the <code>key</code> was mapped
0N/A * in this dictionary, or <code>null</code> if the key did not
0N/A * have a previous mapping.
0N/A * @exception NullPointerException if the <code>key</code> or
0N/A * <code>value</code> is <code>null</code>.
0N/A * @see java.lang.Object#equals(java.lang.Object)
0N/A * @see java.util.Dictionary#get(java.lang.Object)
0N/A */
0N/A abstract public V put(K key, V value);
0N/A
0N/A /**
0N/A * Removes the <code>key</code> (and its corresponding
0N/A * <code>value</code>) from this dictionary. This method does nothing
0N/A * if the <code>key</code> is not in this dictionary.
0N/A *
0N/A * @param key the key that needs to be removed.
0N/A * @return the value to which the <code>key</code> had been mapped in this
0N/A * dictionary, or <code>null</code> if the key did not have a
0N/A * mapping.
0N/A * @exception NullPointerException if <tt>key</tt> is <tt>null</tt>.
0N/A */
0N/A abstract public V remove(Object key);
0N/A}