isEmpty(): This method is available in java.util.Dictionary class of Java.
Syntax:
boolean java.util.Dictionary.isEmpty()
This method tests if this dictionary maps no keys to value.
Note: The general contract for the isEmpty method is that the result is true if and only if this dictionary contains no entries.
Parameters: NA
Returns: true if this dictionary maps no keys to values; false otherwise.
Exceptions: NA
Approach
Java
import java.util.Dictionary;import java.util.Hashtable;public class DictionaryeisEmpty {public static void main(String[] args) {Dictionary<String, Integer> dictionary =new Hashtable<String, Integer>();dictionary.put("Hello", 10);dictionary.put("Java", 4);dictionary.put("C++", 17);System.out.println(dictionary.isEmpty());}}
Output:
false
No comments:
Post a Comment