Click here to watch in Youtube :
https://www.youtube.com/watch?v=jT0ZTVJfHAY&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
Output
https://www.youtube.com/watch?v=jT0ZTVJfHAY&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
import java.util.Hashtable; /* * Example of isEmpty() method. */ public class HashtableExample { public static void main( String[] args ) { Hashtable<String, String> hashtable = new Hashtable<String, String>(); System.out.println("hashtable : " + hashtable); /* * Tests if this hashtable maps no keys to values. */ boolean isEmpty = hashtable.isEmpty(); System.out.println("isEmpty : " + isEmpty + "\n"); /* * Key = CountryCode,Value = CountryName */ hashtable.put("AF", "AFGHANISTAN"); hashtable.put("BE", "BELGIUM"); hashtable.put("US", "UNITED STATES"); hashtable.put("IN", "INDIA"); System.out.println("hashtable : " + hashtable); isEmpty = hashtable.isEmpty(); System.out.println("isEmpty : " + isEmpty); } }
hashtable : {} isEmpty : true hashtable : {IN=INDIA, AF=AFGHANISTAN, BE=BELGIUM, US=UNITED STATES} isEmpty : false
https://sites.google.com/site/javaee4321/java-collections/HashtableDemoIsEmpty.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment