Dictionary.isEmpty() has the following syntax.
public abstract boolean isEmpty()
In the following code shows how to use Dictionary.isEmpty() method.
import java.util.*; //from w w w. ja v a 2s. c o m public class Main { public static void main(String[] args) { Dictionary d = new Hashtable(); // add elements in the hashtable d.put("1", "from java2s.com"); 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); } }
The code above generates the following result.