<div style='background-color: none transparent;'></div>
Home » » Example of keySet method of HashMap.

Example of keySet method of HashMap.

HashMapKeySet.java

package net.roseindia.java;

import java.util.HashMap;

import java.util.Set;

public class HashMapKeySet {

public static void main(String[] arr) {

/* Create object of HashMap */

HashMap obHashMap = new HashMap();

/* Strore value in HashMap */

obHashMap.put(new Integer(1), "AAA");

obHashMap.put(new Integer(2), "BBB");

obHashMap.put(new Integer(3), "CCC");

obHashMap.put(new Integer(4), "DDD");

obHashMap.put(new Integer(5), "EEE");

/* Create a set of keys of hashmap */

Set obKeySet = obHashMap.keySet();

System.out.println("Set of Keys : " + obKeySet); } }
Share this article :
 
Copyright © 2011. B.Sc B.Tech MCA Ploytechnic Mini,Main Projects | Free Main Projcets Download | MCA |B.tech . All Rights Reserved
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Template Modify by Creating Website. Inpire by Darkmatter Rockettheme Proudly powered by Blogger