📜  Java.util.Dictionary类

📅  最后修改于: 2020-11-14 06:15:04             🧑  作者: Mango


介绍

java.util.Dictionary类是任何类的抽象父类,例如Hashtable,它将键映射到值。以下是有关Dictionary的重点:

  • 在此类中,每个键和每个值都是一个对象。

  • 在他的类对象中,每个键最多与一个值关联。

类声明

以下是java.util.Dictionary类的声明-

public abstract class Dictionary
   extends Object

类的构造函数

Sr.No. Constructor & Description
1

Dictionary()

This is the single constructor.

类方法

Sr.No. Method & Description
1 abstract Enumeration elements()

This method returns an enumeration of the values in this dictionary.

2 abstract V get(Object key)

This method returns the value to which the key is mapped in this dictionary.

3 abstract boolean isEmpty()

This method tests if this dictionary maps no keys to value.

4 abstract Enumeration keys()

This method returns an enumeration of the keys in this dictionary.

5 abstract V put(K key, V value)

This method maps the specified key to the specified value in this dictionary.

6 abstract V remove(Object key)

This method removes the key (and its corresponding value) from this dictionary.

7 abstract int size()

This method returns the number of entries (distinct keys) in this dictionary.

方法继承

此类从以下类继承方法-

  • java.util.Object