Properties boolean isEmpty() method Example Program


Tests if this hashtable maps no keys to values.

Program

package com.candidjava;

import java.util.Hashtable;
import java.util.Properties;

/* 
 * @author : Mohan 
 * @description : The isEmpty() method is used to test if this hashtable maps no keys to values.
 */
public class PropertiesIsEmpty {
	public static void main(String[] args) {
		Properties properties = new Properties();
		Hashtable ht = new Hashtable(properties);
		ht.put("1", "hari");
		ht.put("2", "anand");
		ht.put("3", "vinoth");
		ht.put("4", "mohan");
		ht.put("5", "karthick");
		System.out.println(ht);
		System.out.println(ht.isEmpty());
	}
}

Output

{5=karthick, 4=mohan, 3=vinoth, 2=anand, 1=hari}
false

Explanation

public boolean isEmpty()
Tests if this hashtable maps no keys to values.
Specified by:
isEmpty in interface Map
Specified by:
isEmpty in class Dictionary
Returns:
true if this hashtable maps no keys to values; false otherwise.


Related Post

Comments


©candidjava.com