java.util.Dictionary.isEmpty()%uA0方法检查,如果这个字典里没有键的值。
声明
以下是java.util.Dictionary.isEmpty()方法的声明
public abstract boolean isEmpty()
参数
-
NA
返回值
如果这个字典里没有键的值,该方法返回true否则为false。
异常
-
NA
例子
下面的示例演示java.util.Dictionary.isEmpty()方法的用法。
package com.yiibai import java.util.* public class DictionaryDemo { public static void main(String[] args) { // create a new hashtable Dictionary d = new Hashtable() // add elements in the hashtable d.put("1", "Chocolate") d.put("2", "Cocoa") d.put("5", "Coffee") // return true if this dictionary maps no keys to value. boolean b = d.isEmpty() System.out.println("Dictionary is empty:" + b) } }
让我们来编译和运行上面的程序,这将产生以下结果:
Dictionary is empty:false