Class Dictionary<K,V>
java.lang.Object
java.util.Dictionary<K,V>
- Direct Known Subclasses:
Hashtable
Note: Do not use this class since it is obsolete. Please use the
Map interface for new implementations.
Dictionary is an abstract class which is the superclass of all classes that
associate keys with values, such as Hashtable.
- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Enumeration<V> elements()Returns an enumeration on the elements of this dictionary.abstract VReturns the value which is associated withkey.abstract booleanisEmpty()Returns true if this dictionary has no key/value pairs.abstract Enumeration<K> keys()Returns an enumeration on the keys of this dictionary.abstract VAssociatekeywithvaluein this dictionary.abstract VRemoves the key/value pair with the specifiedkeyfrom this dictionary.abstract intsize()Returns the number of key/value pairs in this dictionary.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Constructor Details
-
Dictionary
public Dictionary()Constructs a new instance of this class.
-
-
Method Details
-
elements
Returns an enumeration on the elements of this dictionary.- Returns:
- an enumeration of the values of this dictionary.
- See Also:
-
get
-
isEmpty
public abstract boolean isEmpty()Returns true if this dictionary has no key/value pairs.- Returns:
trueif this dictionary has no key/value pairs,falseotherwise.- See Also:
-
keys
Returns an enumeration on the keys of this dictionary.- Returns:
- an enumeration of the keys of this dictionary.
- See Also:
-
put
Associatekeywithvaluein this dictionary. Ifkeyexists in the dictionary before this call, the old value in the dictionary is replaced byvalue.- Parameters:
key- the key to add.value- the value to add.- Returns:
- the old value previously associated with
keyornullifkeyis new to the dictionary. - See Also:
-
remove
-
size
public abstract int size()Returns the number of key/value pairs in this dictionary.- Returns:
- the number of key/value pairs in this dictionary.
- See Also:
-