10:05 pm - Monday October 15, 2018

HashMap Example program for isEmpty()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
Author :candidjava.com
Description: Returns true if this map contains no key-value mappings.
*/
import java.util.*;
public class HashMapEmpty
 {
public static void main(String arg[])
{
HashMap<Integer, String> osHashMap = new HashMap<Integer, String>(); // Create object  of hashmap
osHashMap.put(new Integer(1), "ABC");
osHashMap.put(new Integer(2), "DEF");
osHashMap.put(new Integer(3), "GHI");
System.out.println("Hash map:"+osHashMap.isEmpty());
}
 }

Output:
HashMap:false

BACK

Filed in: Z-A All Java Codes

Comments are closed.