Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Dictionary

public abstract class Dictionary
extends Object

java.lang.Object
   ↳ java.util.Dictionary<K, V>
Known Direct Subclasses
Known Indirect Subclasses


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.

See also:

Summary

Public constructors

Dictionary()

Constructs a new instance of this class.

Public methods

abstract Enumeration<V> elements()

Returns an enumeration on the elements of this dictionary.

abstract V get(Object key)

Returns the value which is associated with key.

abstract boolean isEmpty()

Returns true if this dictionary has no key/value pairs.

abstract Enumeration<K> keys()

Returns an enumeration on the keys of this dictionary.

abstract V put(K key, V value)

Associate key with value in this dictionary.

abstract V remove(Object key)

Removes the key/value pair with the specified key from this dictionary.

abstract int size()

Returns the number of key/value pairs in this dictionary.

Inherited methods

From class java.lang.Object

Public constructors

Dictionary

Added in API level 1
Dictionary ()

Constructs a new instance of this class.

Public methods

elements

Added in API level 1
Enumeration<V> elements ()

Returns an enumeration on the elements of this dictionary.

Returns
Enumeration<V> an enumeration of the values of this dictionary.

See also:

get

Added in API level 1
V get (Object key)

Returns the value which is associated with key.

Parameters
key Object: the key of the value returned.
Returns
V the value associated with key, or null if the specified key does not exist.

See also:

isEmpty

Added in API level 1
boolean isEmpty ()

Returns true if this dictionary has no key/value pairs.

Returns
boolean true if this dictionary has no key/value pairs, false otherwise.

See also:

keys

Added in API level 1
Enumeration<K> keys ()

Returns an enumeration on the keys of this dictionary.

Returns
Enumeration<K> an enumeration of the keys of this dictionary.

See also:

put

Added in API level 1
V put (K key, 
                V value)

Associate key with value in this dictionary. If key exists in the dictionary before this call, the old value in the dictionary is replaced by value.

Parameters
key K: the key to add.
value V: the value to add.
Returns
V the old value previously associated with key or null if key is new to the dictionary.

See also:

remove

Added in API level 1
V remove (Object key)

Removes the key/value pair with the specified key from this dictionary.

Parameters
key Object: the key to remove.
Returns
V the associated value before the deletion or null if key was not known to this dictionary.

See also:

size

Added in API level 1
int size ()

Returns the number of key/value pairs in this dictionary.

Returns
int the number of key/value pairs in this dictionary.

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.